Adobe Dreamweaver Forums



Last 10 THreads :         On hitTest go to next frame? Why doesn't this work? (Last Post : Koolaz Games - Replies : 0 - Views : 1 )           »          Contribue won't allow Images to be inserted (Last Post : RiderAlberta - Replies : 0 - Views : 1 )           »          This just sucks.... (Last Post : TC2112 - Replies : 11 - Views : 12 )           »          Update from array (Last Post : -==cfSearching==- - Replies : 3 - Views : 4 )           »          PHP Notice Problem (Last Post : UteFanJason - Replies : 7 - Views : 8 )           »          Limited Ammo (Last Post : kglad - Replies : 19 - Views : 20 )           »          Icon Text sticks when returning to home page.. (Last Post : kglad - Replies : 1 - Views : 2 )           »          controlling Flash player (Last Post : motonutty - Replies : 0 - Views : 1 )           »          Communicating with FLASH player via actionscript (Last Post : motonutty - Replies : 0 - Views : 1 )           »          button skin (Last Post : Merlyn MM - Replies : 4 - Views : 5 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Cold Fusion
 
Tags: , ,

Reply
  #11 (permalink)  
Old 07-14-2008, 05:47 AM
Olivia Crazy Horse
 
Posts: n/a
Diggs:
Default Re: How to retain form 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

Reply With Quote
Sponsored Links
  #12 (permalink)  
Old 07-14-2008, 05: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
  #13 (permalink)  
Old 07-16-2008, 03:45 PM
Olivia Crazy Horse
 
Posts: n/a
Diggs:
Default Re: How to retain form values

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>>&nbsp;Supplier&nbsp;&nbs p;

<input type="checkbox" name="fault" value="Raytheon">&nbsp;Company&nbsp;&nbsp;

<input type="checkbox" name="fault" onClick="showTextboxes(1);"
value="Carrier">&nbsp;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 ?

Reply With Quote
  #14 (permalink)  
Old 07-23-2008, 02:40 AM
dongzky
 
Posts: n/a
Diggs:
Default Re: How to retain form values

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

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 12:09 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk