Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
kt03 #1
passing varible
How do I pass the automatic name from page to page to find out the value. Here
is my explanation.
I have index.cfm with all the radio boxes for YES/ NO and it associated with
the ID from the database. On the next page, I want able to track down which ID
selected YES and which ID selected NO in order to send out the email to them.
index.cfm
=================
<form action="next.cfm" method="post">
<input type="radio" name="vip_#id#" value="1" >YES
<input type="radio" name="vip_#id#" value="0" checked">NO
</form>
next.cfm
=================
<cfoutput>#???#</cfoutput>
thanks
kt03 Guest
-
Varible clearance, mouse/keyboard
I seem to be having problems with my login scripts. I have mentioned this here before, but have some more ideas i would like to run past you all.... -
Onlick and Passing varible
I have the page: one textbox, one button using Onclick. User enter name from textbox then click "Go button", pop-up page open and display name. I... -
Simple varible wont work!
Hey heres the code: <? if (xbt = 1) { ?> <tr><Td colspan=2><center>The STATS are from the XBT tracker we run as the backend of the... -
Varible Problem
Hi, I have a problem with the structure of my website which is causing problem with passing variables between functions, even when declared as... -
Seting A Flash Varible with a URL
Hey all, I posted this question to data_intergration and got no responce, thought this might be a better forum for it. I need to set a varible... -
SteveBryant #2
Re: passing varible
<cfoutput>#YesNoFormat(Form["vip_#id#"])#</cfoutput>
The key here is that form variables can be accessed as structures (as of CFMX,
they actually are structures.So, Form["field"] is the equivalent of Form.field.
This is especially helpful in situations like yours where you need to get a
dynamically named field.
So, to get a field named "vip_#id#", you use Form["vip_#id#"]
SteveBryant Guest
-
jdeline #3
Re: passing varible
Unlike <INPUT TYPE="text">, radio buttons that are unchecked are not available
as FORM fields on next.cfm. So you will have to use the IsDefined( ) function
before you try to process them.
Also, there is a FORM field called "fieldnames" that is a comma-delimited list
of FORM fields that have been submitted. So you can set up a list loop over
fieldnames, search for the next occurrence of "vip_" using the ListContains( )
function and use that list element as the radio button's variable name. You
will have to use the Evaluate( ) function to obtain it's value.
Hope this helps.
jdeline Guest
-
kt03 #4
Re: passing varible
SteveBryant ,
Yes, I try your <cfoutput>Form["vip_#id#"]</cfoutput>, but all I got pass over
just name not value such as:
id: Form["vip_278,279,280,281,282"]
I want to able to find out which id was selected NO and which id was selected
YES
Thanks
kt03 Guest
-
reenaroy #5
Re: passing varible
Hi KT
Try this................
index.cfm
=================
<form action="next.cfm" method="post">
<input type=hidden name=id value="#id#">
<input type="radio" name="vip_#id#" value="1" >YES
<input type="radio" name="vip_#id#" value="0" checked">NO
</form>
next.cfm
=================
<cfset id=form.id>
<cfset vipID=Form["vip_#id#"]>
<cfoutput>#vipID#</cfoutput>
reenaroy Guest
-
SteveBryant #6
Re: passing varible
You have a few choices here:
1) Dont pass the id in the form. Instead, on the action page, loop over the
same query that you used on the form page.
2) Use the form as reenaroy suggested (which is probably what you are doing)
and take advantage of the id being passed as a list by using list functions:
<cfoutput>
<cfloop index="thisID" list="#Form.id#">
<cfif StuctKeyExists(Form,"vip_#thisID#")>
#YesNoFormat(Form["vip_#thisID#"])#<br/>
</cfif>
</cfloop>
</cfoutput>
Make sense?
SteveBryant Guest
-
kt03 #7
Re: passing varible
reenaroy ,
I tried your code and I got this error below:
Element vip_278,279,280,281,282 is undefined in a Java object of type class coldfusion.filter.FormScope referenced as
Thanks
kt03 Guest
-
kt03 #8
Re: passing varible
SteveBryant ,
I tried your sugessted and I got this error: Variable STUCTKEYEXISTS is undefined. Where do I get STUCTKEYEXISTS ?
Thanks
kt03 Guest
-
SteveBryant #9
Re: passing varible
Sorry about that. It should have been StructKeyExists.
Hopefully that was my only type.
Sorry for the trouble.
SteveBryant Guest
-
kt03 #10
Re: passing varible
SteveBryant ,
I thought that too, I corrected that after I posted the message and it worked.
Thanks a lot
kt03 Guest



Reply With Quote

