The problem:
1) I build a multiple select box from data in a MS SQL 7.0 database
table.
2) A person fills out the form and makes multiple selections in the
select box
3) The person fills out the rest of the form properly except his
password is too short and is caught by my validation routine
4) The form is returned with the password field in red for the person to
make corrections.
5) Since the user made multiple selections in the select box, all
selections are gone.
6) This code works if they only make one selection.
7) Any ideas on how to make it keep the multiple selections if other
errors are caught in the form?


Query to build select box from database:
<cfquery name="GetMedium" datasource="#dataname#">
 SELECT MediumID,MediumDescription AS MediumList FROM Mediums
</cfquery>

Original CFSELECT code in the preprocessed CFM document:
<tr>
 <td valign="top"><cf_vtag item="Medium(s)"
verr="#validation_error#"></td>
 <td valign="top">
  <cfselect name="Medium"
   size="6"
   query="GetMedium"
   value="MediumID"
   display="MediumList"
   multiple="Yes"
   selected="#Medium#"
   message="Please select at least one medium you work with."
   required="Yes">
  </cfselect>
 </td>
</tr>


SELECT code source viwed in browser:
<td valign="top">
<SELECT MULTIPLE NAME="Medium" SIZE=6>
 <OPTION VALUE="1">Acrylic
 <OPTION VALUE="2">Alabaster
 <OPTION VALUE="3">Oil
 <OPTION VALUE="4">Sculpture
</SELECT>
</td>


Custom vtag.cfm:
<cfif listfindnocase(#attributes.verr#, #attributes.item#)>
 <font color="red">
</cfif>
<cfoutput><font face="sans-serif, Arial, helvetica"
size="-1"><b>#attributes.item#:</b></font></cfoutput>
<cfif listfindnocase(#attributes.verr#, #attributes.item#)>
 </font>
</cfif>


Code snippet from the validate function:
<cfif len(Trim(ArtistPassword)) lt 6>
 <cfset validation_error = listappend(validation_error,
"ArtistPassword")>
</cfif>

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to