0
2 forms on same page
Explorer
,
/t5/coldfusion-discussions/2-forms-on-same-page/td-p/149244
Nov 27, 2008
Nov 27, 2008
Copy link to clipboard
Copied
Is it possible in Coldfusion(v8) to have 2 forms on the same
page, name them and return the variable.
Something like this. although the form variable is a system variable so how would it work?
<cfdump var="#form.username#"></cfdump>
<cfdump var="#form2.email#"></cfdump>
Something like this. although the form variable is a system variable so how would it work?
<cfdump var="#form.username#"></cfdump>
<cfdump var="#form2.email#"></cfdump>
TOPICS
Getting started
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/coldfusion-discussions/2-forms-on-same-page/m-p/149245#M13666
Nov 27, 2008
Nov 27, 2008
Copy link to clipboard
Copied
Yeah... You can have.. But you can submit one at a
time...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/2-forms-on-same-page/m-p/149246#M13667
Nov 27, 2008
Nov 27, 2008
Copy link to clipboard
Copied
What Daverms says, plus
<cfif isDefined("form.username")>
<cfoutput>#form.username#</cfoutput>
or
<cfdump var="#form#">
</cfif>
<cfif isDefined("form2.email")>
<cfoutput>#form2.email#</cfoutput>
or
<cfdump var="#form2#">
</cfif>
<cfif isDefined("form.username")>
<cfoutput>#form.username#</cfoutput>
or
<cfdump var="#form#">
</cfif>
<cfif isDefined("form2.email")>
<cfoutput>#form2.email#</cfoutput>
or
<cfdump var="#form2#">
</cfif>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Hulfy
AUTHOR
Explorer
,
/t5/coldfusion-discussions/2-forms-on-same-page/m-p/149247#M13668
Nov 27, 2008
Nov 27, 2008
Copy link to clipboard
Copied
I can't get it to work can someone post an exmaple please?
Thanks
Thanks
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/2-forms-on-same-page/m-p/149248#M13669
Nov 27, 2008
Nov 27, 2008
Copy link to clipboard
Copied
What are you trying to do and what is happening when you
try?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/2-forms-on-same-page/m-p/149249#M13670
Nov 29, 2008
Nov 29, 2008
Copy link to clipboard
Copied
<!--- use sbmt1, sbmt2 to distinguish between the
submitted forms --->
<cfif isDefined("form.sbmt1")>
<cfset form1=form>
<cfelseif isDefined("form.sbmt2")>
<cfset form2=form>
</cfif>
<cfif isDefined("form1.username")>
form1.username: <cfoutput>#form1.username#</cfoutput><br>
form1 dump <cfdump var="#form1#">
</cfif>
<cfif isDefined("form2.email")>
form2.email: <cfoutput>#form2.email#</cfoutput><br>
form2 dump <cfdump var="#form2#">
</cfif>
<cfoutput><FORM action="#cgi.script_name#" method="post"></cfoutput>
User: <INPUT type="text" name="username"><BR>
<INPUT type="submit" name="sbmt1" value="Send">
</FORM>
</P>
<P>
<cfoutput><FORM action="#cgi.script_name#" method="post"></cfoutput>
Email: <INPUT type="text" name="email"><BR>
<INPUT type="submit" name="sbmt2" value="Send">
</FORM>
</P>
<cfif isDefined("form.sbmt1")>
<cfset form1=form>
<cfelseif isDefined("form.sbmt2")>
<cfset form2=form>
</cfif>
<cfif isDefined("form1.username")>
form1.username: <cfoutput>#form1.username#</cfoutput><br>
form1 dump <cfdump var="#form1#">
</cfif>
<cfif isDefined("form2.email")>
form2.email: <cfoutput>#form2.email#</cfoutput><br>
form2 dump <cfdump var="#form2#">
</cfif>
<cfoutput><FORM action="#cgi.script_name#" method="post"></cfoutput>
User: <INPUT type="text" name="username"><BR>
<INPUT type="submit" name="sbmt1" value="Send">
</FORM>
</P>
<P>
<cfoutput><FORM action="#cgi.script_name#" method="post"></cfoutput>
Email: <INPUT type="text" name="email"><BR>
<INPUT type="submit" name="sbmt2" value="Send">
</FORM>
</P>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/2-forms-on-same-page/m-p/149250#M13671
Dec 03, 2008
Dec 03, 2008
Copy link to clipboard
Copied
Hulfy wrote:
...name them and return the variable
Do you mean something like this?
<FORM action="actionPage.cfm" method="post" name="myForm">
User: <INPUT type="text" name="username"><BR>
<INPUT type="submit" name="sbmt1" value="Send">
</FORM>
Then refer to the variable myForm.username? That may work in Javascript and other scripting languages, but I don't expect it will in Coldfusion. Upon submit, Coldfusion returns its own form structure, named, what else, form.
...name them and return the variable
Do you mean something like this?
<FORM action="actionPage.cfm" method="post" name="myForm">
User: <INPUT type="text" name="username"><BR>
<INPUT type="submit" name="sbmt1" value="Send">
</FORM>
Then refer to the variable myForm.username? That may work in Javascript and other scripting languages, but I don't expect it will in Coldfusion. Upon submit, Coldfusion returns its own form structure, named, what else, form.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Hulfy
AUTHOR
Explorer
,
LATEST
/t5/coldfusion-discussions/2-forms-on-same-page/m-p/149251#M13672
Dec 04, 2008
Dec 04, 2008
Copy link to clipboard
Copied
That's what was confusing me. So either name the submit or a
hidden variable would do the trick.
This kind of answers my other question.
This kind of answers my other question.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

