Skip to main content
Participant
August 3, 2008
Question

preservedata and checkboxes

  • August 3, 2008
  • 3 replies
  • 1197 views
Got a cfform with checkbox cfinputs they are looped about 4 boxes total. on page refresh all check boxes become selected instead of just the couple I have selected.

Whats the fix for this?
This topic has been closed for replies.

3 replies

Participant
August 5, 2008
thats a good idea but I'm not making this site in flash or any parts of it. I might see how hard it is just to use spry or some type of javascript. Thanks for taking a look at this for me though. I'm finding some features are a little buggy yet in cf 8
Inspiring
August 5, 2008
Hi,

What happens when you add ' method="post" ' to your existing <cfform> tag?...

Participant
August 5, 2008
So i tried post / action / encrypt same thing.
When I took the checkboxes out of the loop and made 3 individual inputs with different names everything worked like it was supposed to. Thing is I want them all named category and then I want to loop over a list of possible categories for the value.
Inspiring
August 5, 2008
Hi,

If your format is flash (I don't know which one you have).. and if you want to put your checkbox as a named control, you can try the <cfformgroup type="repeater" query="your_query"> and that will work..

But I am still unsure whether this will meet your requirement.
Inspiring
August 5, 2008
Hi,

Can you post your code here?.
Participant
August 5, 2008
<cfform preservedata="yes">
<table cellpadding="0" cellspacing="0" border="0">

<cfloop from="1" to="#ArrayLen(fieldOptions[url.pagesName].insertOptions)#" index="i">
<cfoutput>

<cfswitch expression="#fieldOptions[url.pagesName].insertOptions .form#">

<cfcase value="location">


<cfset location = ListToArray(fieldOptions[url.pagesName].insertOptions
.field)>


<cfinvoke
component="cfc.articlePages"
method="getCountry"
returnvariable="getCountry">
</cfinvoke>
<cfinvoke
component="cfc.articlePages"
method="getState"
returnvariable="getState">
</cfinvoke>
<cfinvoke
component="cfc.articlePages"
method="getCity"
returnvariable="getCity">
</cfinvoke>

<tr><td id="articleTitleLayout"> <strong>#fieldOptions[url.pagesName].insertOptions .title#</strong><br />
<span id="alertRed">#fieldOptions[url.pagesName].insertOptions
.hint#</span></td><td id="articleLayout">
<table>

<tr><td>Country</td><td> <cfselect name="#location[1]#" query="getCountry" display="country" value="countryId" required="no" message="Must enter Country for #fieldOptions[url.pagesName].insertOptions .title#" class="form" queryPosition="below"><option value="" selected="selected">All</option></cfselect></td></tr>

<tr><td>State</td><td><cfselect name="#location[2]#" query="getState" display="state" value="stateId" required="no" message="Must enter State for #fieldOptions[url.pagesName].insertOptions
.title#" class="form" queryPosition="below"><option value="" selected="selected">All</option></cfselect></td><td></td></tr>

<tr><td>City</td><td><cfselect name="#location[3]#" query="getCity" display="city" value="cityId" required="no" message="Must enter city for #fieldOptions[url.pagesName].insertOptions .title# " class="form" queryPosition="below"><option value="" selected="selected">All</option></cfselect></td><td></td></tr>
<tr><td>
</table>


</td><tr>






</cfcase><cfcase value="checkBox">
<tr><td id="articleTitleLayout"><strong>#fieldOptions[url.pagesName].insertOptions
.title#</strong><br />
<span id="alertRed">#fieldOptions[url.pagesName].insertOptions .hint#</span></td><td id="articleLayout">
<cfinput type="checkbox" name="#fieldOptions[url.pagesName].insertOptions
.field#" value="#fieldOptions[url.pagesName].insertOptions .formOptions#" id="form"> All
<cfloop list="#fieldOptions[url.pagesName].insertOptions
.formOptions#" delimiters="," index="list">
<cfinput type="checkbox" name="#fieldOptions[url.pagesName].insertOptions .field#" value="#list#" required="no" message="Must Select A #fieldOptions[url.pagesName].insertOptions.title#" id="form">#list#
</cfloop>
</td>
</tr>
</cfcase>



<cfcase value="radio">
<tr><td id="articleTitleLayout"><strong>#fieldOptions[url.pagesName].insertOptions .title#</strong><br />
<span id="alertRed">#fieldOptions[url.pagesName].insertOptions
.hint#</span></td><td id="articleLayout">
<cfinput type="radio" name="#fieldOptions[url.pagesName].insertOptions .field#" value="#fieldOptions[url.pagesName].insertOptions.formOptions#" id="form"> All
<cfloop list="#fieldOptions[url.pagesName].insertOptions .formOptions#" delimiters="," index="list">
<cfinput type="radio" name="#fieldOptions[url.pagesName].insertOptions
.field#" value="#list#" required="no" message="Must Select A #fieldOptions[url.pagesName].insertOptions .title#" id="form">#list#
</cfloop>
</td></tr>
</cfcase>

</cfswitch>
</cfoutput>

</cfloop>
<tr><td id='articleTitleLayout'><strong>Text Search</strong></td><td id='articleLayout'><cfinput type="text" name="searchText" value="" required="no" message="Must Enter A Search Term" id="form" ></td>
<td><cfinput type="submit" name="submitFilterData" value="Filter" id="form"></td></tr>
</table>
</cfform>

there it is radio,text,selects work just fine just the checkboxes are retarded. Any advice would be grateful!