Would something like this work for you?

<input name="#moduleID#" type="radio" class="user5" value="5" 
        <cfif FORM.moduleID EQ 5 OR 
                (structkeyexists(form, moduleID) and form[moduleID] eq 5)
        >checked</cfif> 
/>


On Mon, 7 Feb 2005 13:39:32 -0500, Mark Leder <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> On an initial form display, I have a query looping through radio buttons to
> dynamically populate the radio names and values, works great.  The query set
> returns the #moduleID#, which is numeric.
> When I submit the form, the same page is called again, and I have some
> server-side form validation run to check the fields.  If a validation fails,
> I re-display the same form, with an error message, and repopulate the form
> fields, so the user doesn't have to type things in again, only make
> corrections and resubmit.
> 
> Here's the problem, I can't figure out how to repopulate the radio buttons
> dynamically from the FORM values.  In doing a form dump after the initial
> submit, I get the following:
> 
> Module ID   Value
> 133            5
> 141            3
> And so on.  These are correct.
> 
> The end result of this would be to insert rows into a db with each row
> containing a field for moduleID and another field for the value 0 thru 5.
> 
> What's a good way of accomplishing this?
> 
> <form name="form1" method="post" action="#CGI.SCRIPT_NAME#>
> <table border="0" cellspacing="0" cellpadding="0">
>  <cfoutput>
>  <cfloop query="qCompanyAuthentication">
>  <tr>
>   <td valign="top">#qCompanyAuthentication.moduleName#&nbsp;&nbsp;&nbsp;<br
> /></td>
>   <td><input name="#moduleID#" type="radio" class="user5" value="5" <cfif
> FORM.moduleID EQ 5>checked</cfif> /></td>
>   <td><input name="#moduleID#" type="radio" class="user4" value="4" <cfif
> FORM.moduleID EQ 4>checked</cfif> /></td>
>   <td><input name="#moduleID#" type="radio" class="user3" value="3" <cfif
> FORM.moduleID EQ 3>checked</cfif> /></td>
>   <td><input name="#moduleID#" type="radio" class="user2" value="2" <cfif
> FORM.moduleID EQ 2>checked</cfif> /></td>
>   <td><input name="#moduleID#" type="radio" class="user1" value="1" <cfif
> FORM.moduleID EQ 1>checked</cfif> /></td>
>   <td><input name="#moduleID#" type="radio" class="user0" value="0" <cfif
> FORM.moduleID EQ 0>checked</cfif> /></td>
>  </tr>
>  </cfloop>
>  </cfoutput>
> </table>
> </form>
> 
> <!--- This is an example of validation --->
> <cfcase value="Yes"><!--- runs through when the form gets posted --->
>   <!--- If a challenge response is entered, but no question --->
>   <cfif Len(Trim(FORM.challengeResponse))>
>    <cfif FORM.challengeQuestion EQ "> Select Question">
>     <cfset entryErrors = ListAppend(entryErrors, "103d", ";")>
>    </cfif>
>   </cfif>
> 
>     <cfif entryErrors EQ "">
> 
>         <!--- Insert into a db --->
>         <!--- Redirect somwhere else --->
>         <cfabort>
> 
>     <cfelse>
>         <!--- The repopulation can happen here, or set other variables as
> needed --->
>     </cfif>
> 
> <cfcase value="No"><!--- Runs when the form is initially displayed, without
> user input --->
>   <cfscript>
>    FORM.userInactive = "0";
>    FORM.moduleID = "4";
>   </cfscript>
> </cfcase>
> 
> ==================
> 
> Thanks,
> Mark
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:193461
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to