Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFFORM Conditional Action

New Here ,
May 02, 2006 May 02, 2006
I am wondering if you can nest a cfif inside the action attribute of the cfform tag. I would like to specify two different form actions depending on the existance of a record in a record set. Something like this:

<cfform id="form1" name="form1" method="post" action=
<cfif #Form.subid# = #ExistsSubid.subid#>
"Action1.cfm"
<cfelse>
"Action2.cfm"
</cfif>
>
ExistsSubid is the name of the record set, and the form.subid contains the value I would like to compare with the record set.
TOPICS
Advanced techniques
360
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 02, 2006 May 02, 2006
Causes much fewer headaches:

<cfif Form.subid EQ ExistsSubid.subid>
<cfset actionPage = "Action1.cfm">
<cfelse>
<cfset actionPage = "Action2.cfm">
</cfif>

<cfform id="form1" name="form1" method="post" action="#actionPage#">


Translate
Community Expert ,
May 02, 2006 May 02, 2006
LATEST
Causes much fewer headaches:

<cfif Form.subid EQ ExistsSubid.subid>
<cfset actionPage = "Action1.cfm">
<cfelse>
<cfset actionPage = "Action2.cfm">
</cfif>

<cfform id="form1" name="form1" method="post" action="#actionPage#">


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources