Multiple Selection Box Problem

Results 1 to 2 of 2

Thread: Multiple Selection Box Problem

  1. #1
    James Barrett Guest

    Default Multiple Selection Box Problem

    Hi all,<BR><BR>I have created an ASP form that reads and writes data to an SQL DB. The problem that I&#039m having is this:<BR><BR>I have 3 multiple select boxes on the form. I have an Edit page to update the records but I can&#039t find a way to have the Multiple Selection Box populated with the data from the DB when you come to edit the record.<BR><BR>I.E. You created a record, say - you choose 3 colours from a multiple selection box and you submit the form, no problem. You then decide you want to change the 3 colours you selected so you go to the edit page but the Multiple Selection Box does not highlight the previous seletions you made.<BR><BR>Sorry for the long winded style of this message.<BR><BR>TIA<BR><BR>James

  2. #2
    Daniel Newman Guest

    Default RE: Multiple Selection Box Problem

    The multiple select field allows elements to be "selected" from within the HTML source, as you would a single select field. To solve your problem, you&#039d need to run it past a function first that would check your Request.Form() entry with the data you&#039re getting from your RecordSet, and if the two are the same, add a "SELECTED" into the &#060;OPTION&#062; part of the HTML tag.<BR><BR>I think something like this would work:<BR><BR>&#060;%<BR>Function CheckMultipleSelect(rsEntry,FormEntry)<BR> If StrComp(rsEntry,FormEntry) = true Then [I think True = 0]<BR> CheckMultipleSelect = " SELECTED"<BR> End If<BR>End Function<BR>%&#062;<BR><BR>and call it from the page:-<BR><BR>&#060;SELECT name="colours" multiple&#062;<BR>&#060;!// some sort of DO in here&#062;<BR>&#060;OPTION value="?"&#060;%=CheckMultipleSelect(rsObj("whatev erthisis"),Request.Form("colours"))%&#062;&#062;<B R> &#060;%=rsObj("whateverthisis")%&#062;<BR>&#060 ;/OPTION&#062;<BR>&#060;!// some sort of LOOP in here&#062;<BR>&#060;/SELECT&#062;<BR><BR>hth,<BR>Daniel.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts