View Single Post
  #12 (permalink)  
Old 07-14-2008, 06:47 AM
dongzky
 
Posts: n/a
Diggs:
Default Re: How to retain form values

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


Reply With Quote