![]() |
![]() |
||||||
|
|||||||
| Tags: form, retain, values |
![]() |
|
|||
|
thanks for the reply, dongzky,
I think I understand what you are doing. A couple of questions. Instead of having a form page and and action page, my mgmt only wants one page, so the form page has to submit back to itself. I will have all teh action page processing above the form/cfform statment, and the html form below the form/cfform statement. Will your example still work and is the form variable still treated as if it was submitted to another page ? Also, if I have multiple checkboxes and they all have the same name, how will that work with your example ? thanks |
| Sponsored Links |
|
|||
|
Olivia Crazy Horse wrote:
>Instead of having a form page and and action page, my mgmt only wants one page, so the form page has to >submit back to itself. I will have all teh action page processing above the form/cfform statment, and the html form >below the form/cfform statement. >Will your example still work and is the form variable still treated as if it was submitted to another page ? Yes, the form variables will still be treated as if it was submitted to another page. But in this case, you don't need to store your form values in SESSION variables. All you need to do is do a little tweaking in your form page. Example: Instead of declaring <cfparam name="SESSION.text1" default="">, change it to <cfparam name="FORM.text1" default="">. So all the SESSION.text1 in your form page has to be changed into FORM.text1 Olivia Crazy Horse wrote: > if I have multiple checkboxes and they all have the same name, how will that work? checkboxes with same names, when submitted and if there are any selections, will return a comma-delimited list. so if you want to do some checkings on a checkbox, you might have a code similar to this: <input type="Checkbox" name="myCheckBox" value="value 1" <cfif ListFindNoCase(FORM.myCheckBox,"value 1",",")>checked</cfif>> Checkbox 1 <br /> <input type="Checkbox" name="myCheckBox" value="value 2" <cfif ListFindNoCase(FORM.myCheckBox,"value 2",",")>checked</cfif>> Checkbox 2 |
|
|||
|
I need to go back to the original method of having a form page and an action. I
tried to incorporate your original code and cannot seem to get it to work. Here is what I have on my form page, three checkboxes side by side, checkbox name is fault (I am only testing the first one now) <cfparam name="session.fault" default=""> <cfif isDefined("session.failedValidate") and session.failedValidate> <script> alert("failed validateion") </script> </cfif> <input type="checkbox" name="fault" value="Supplier" <cfif session.fault is "Supplier">checked</cfif>> Supplier &nbs p; <input type="checkbox" name="fault" value="Raytheon"> Company <input type="checkbox" name="fault" onClick="showTextboxes(1);" value="Carrier"> Carrier Here is my action page : <cfparam name="IsValidateSuccessful" default="FALSE"> <cfif IsDefined("FORM.butSubmit")> <cfif Not(IsValidateSuccessful)> <cfset SESSION.fault=FORM.fault> <cfset SESSION.failedValidate = TRUE> <cflocation url="disposition_urdn.cfm" addtoken="No"> <cfelse> <!--- delete session variables if validation is successful to free memory ---> <cfset StructDelete(SESSION,"fault")> <cfset StructDelete(SESSION,"failedValidate")> </cfif> </cfif> I check the first checkbox. There are other checkboxes beneath this one, and if those are not checked, then I return to the form page with a popup error message, hoping to retain the first checkbox check. I just do a cfif not isDefined("next_box_name")>, then cflocation url back to the form page, but the check is not there. What am I doing wrong ? |
|
|||
|
Have you already enabled session variables in the CF admin? Also, did you
already create a <cfapplication> tag, maybe in an Application.cfm, that is set to use SESSION variables? If not, and if you don't know yet how, check the links below: http://livedocs.adobe.com/coldfusion...=sharedVars_10. html http://livedocs.adobe.com/coldfusion...Tags_a-b_5.htm l#1097308 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise