且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

2以一种形式提交按钮

更新时间:2022-12-11 15:02:52

为此,您必须为两个提交按钮添加名称。并且使用该名称可以防止_validate.cfm包含在内,同时通过单击另存为草稿按钮提交表单。

For that you have to add name for the two submit buttons. And using that name we can prevent the _validate.cfm inclusion, while submitting the form through clicking "Save as draft" button.

此外,表单方法应为 POST ,以便在操作页面上可以使用表单范围,否则为

Also the form method should be POST, so that form scope will be available on action page, otherwise it'll available in URL scope.

<cfset tx_name = "">

<cfif isDefined("form.tx_name")>
    <cfset tx_name = form.tx_name>
</cfif>

<cfif isdefined("form.Save")>
    <cfinclude template="_validate.cfm">
</cfif>

<cfif isDefined("form.tx_name")>
    <cfinclude template="_update.cfm">
</cfif>

<form name="something" method="post">
    <input type="text" name="tx_name" value="#tx_name#">
    <input type="submit" name="SaveAsDraft" value="Save as Draft">
    <input type="submit" name="Save" value="Save">
</form>