I have a select box that I am having some troubles with and cannot seem to 
validate it. Can anyone see what I might be doing wrong? When I submit, it 
simply inserts the value "" into the database.

I am building the select option here.

<CFSET APPLICATION.CONDITION="New,Mint,Excellent,Good,Fair,Poor,Refurbished">

And then building the select

    <CFSELECT name="Condition" label="New or Used:" required="yes" 
message="test">
                       <!---give our select an empty value for validation--->
                      <option value="" selected>Choose a condition..</option>
                      <CFLOOP index="i" list="#APPLICATION.CONDITION#" 
delimiters=",">
                        <option value="#Trim(i)#">#Trim(i)#</option>
                      </CFLOOP>
    </CFSELECT>


And then validating on submit

<CFIF not (Len(Trim(form.Condition))>
Do the error processing
</CFIF>


Display the error to the user

<CFIF not Valid>
     <CFOUTPUT>
      <center>
       <table border=0 cellspacing=0 cellpadding=3 cols=1 width="95%">
        <tr>
         <td class="bblackfont">Your submission has incomplete or invalid 
fields. Please make the following changes.</td>
        </tr>
        <tr>
         <td class="redfont"><ul>
           #Error#
          </ul></td>
        </tr>
        <tr>
         <td class="bblackfont">&laquo;&nbsp;<a 
href="javascript:history.back()">Click here to return and correct</a> &nbsp;the 
above listed error(s).</td>
        </tr>
       </table>
      </center>
     </CFOUTPUT>
</CFIF>

Thanks all !! )

Doug B.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264986
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to