Insert All from combo box

Results 1 to 2 of 2

Thread: Insert All from combo box

  1. #1
    TJPeltz Guest

    Default Insert All from combo box

    Is it possible to have an "All" selection in a combo box that would insert all the options of the combo box into the table.<BR>such as a combo box of names from a name table that i could select the "All" option and insert all of the names in the combo box as individual records into an employee table?

  2. #2
    Join Date
    Dec 1969

    Default No such thing as an HTML combo box... I presume you mean a &#060;SELECT&#062; drop down list?<BR><BR>[A combo box is a Microsoft ActiveX control that allows the user to *either* make a selection from a drop down list *or* type in his/her own value.]<BR><BR>Anyway, the answer is "of course". You could either make it the top option in the list or use a separate button beside the list. Making it the top option is problematical: The top line is also the default selection, so if you title it "Select all" and it is already selected, what do you want to have happen if the user does *not* select it??? So I would favor the side by side button. What say you?<BR><BR>Assuming you say yes...<BR><BR>&#060;SELECT Name="theNames" MULTIPLE&#062;<BR>&#060;OPTION Value=""&#062;Select one or more names<BR>&#060;OPTION&#062;John Paul Jones<BR>&#060;OPTION&#062;Admiral Farragut<BR>&#060;OPTION&#062;Horatio Nelson<BR>&#060;/SELECT&#062;<BR><BR>&#060;INPUT Type=Button Value="Select all names"<BR> onClick="selectAll(this.form.theNames);" &#062;<BR><BR>and you will need a JS function to do the selectAll, perhaps something like this:<BR><BR>&#060;SCRIPT Language=JavaScript&#062;<BR>function selectAll(sel)<BR>{<BR> &nbsp; opts = sel.options;<BR> &nbsp; for( ix = 0; ix &#060; opts.length; ++ix )<BR> &nbsp; {<BR> &nbsp; &nbsp; opts[ ix ].selected = true;<BR> &nbsp; }<BR>}<BR>&#060;/SCRIPT&#062;<BR><BR>But there are lots and lots of other ways to do this. You might want to peruse and their JavaScript FAQ for, perhaps, other ideas.<BR><BR>

Posting Permissions

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