Using a Summary Form to Support Local Processing : Option Select ComboBox : Form Control : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP


JavaScript DHTML  »  Form Control   » [  Option Select ComboBox  ]   
 



Using a Summary Form to Support Local Processing

Please note that some example is only working under IE or Firefox.


/*
Mastering JavaScript, Premium Edition
by James Jaworski 

ISBN:078212819X
Publisher Sybex CopyRight 2001
*/
<HTML>
<HEAD>
<TITLE>Submitting the results of local form processing</TITLE>
<SCRIPT LANGUAGE="JavaScript"><!--
function processOrder() {
 order = ""
 order += document.orderForm.model.selectedIndex
 order += document.orderForm.doors.selectedIndex
 order += document.orderForm.color.selectedIndex
 sel = document.orderForm.accessories
 for(i=0;i<sel.length;++i)
  if(sel.options[i].selectedorder += i
 document.submitForm.result.value = order
 document.submitForm.submit()
 return false
}
// --></SCRIPT>
</HEAD>
<BODY>
<H1>Select your next car:</H1>
<PRE>Model           Doors     Color    Accessories</PRE>
<FORM ACTION="" NAME="orderForm"ONSUBMIT="return processOrder()">
<SELECT NAME="model" SIZE="3">
<OPTION>Big Blob</OPTION>
<OPTION>Wild Thing</OPTION>
<OPTION>Penny Pincher</OPTION>
<OPTION>Class Act</OPTION>
</SELECT>
<SELECT NAME="doors" SIZE="3">
<OPTION>doors</OPTION>
<OPTION>doors</OPTION>
</SELECT>
<SELECT NAME="color" SIZE="3">
<OPTION>red</OPTION>
<OPTION>white</OPTION>
<OPTION>blue</OPTION>
<OPTION>black</OPTION>
<OPTION>brown</OPTION>
<OPTION>silver</OPTION>
<OPTION>pink</OPTION>
</SELECT>
<SELECT NAME="accessories" SIZE="3" MULTIPLE="MULTIPLE">
<OPTION>air conditioning</OPTION>
<OPTION>CD player</OPTION>
<OPTION>bigger engine</OPTION>
<OPTION>fancy dashboard</OPTION>
<OPTION>leather seats</OPTION>
</SELECT>
<P><INPUT TYPE="SUBMIT" NAME="order" VALUE="I'll take it!"></P>
</FORM>
<FORM ACTION="http://www.jaworski.com/javascript/echo.cgi"
      METHOD="GET" NAME="submitForm">
<INPUT TYPE="HIDDEN" NAME="result">
</FORM>
</BODY>
</HTML>

           
       
Related examples in the same category
1.  Set select to multiple selected
2.  Options in select
3.  Option label
4.  Option default Selected Example
5.  Option selected Index Example
6.  Option selected
7.  Is Select a select-multiple
8.  'index' Example
9.  'value' Example
10.  Add an option to select
11.  'text' Example
12.  Option selected index
13.  Auto Linked Option Listbox without button
14.  Change background
15.  Changing Select Element Content (two Combobox)
16.  Drop-down Redirect - No Submit button
17.  Drop-down Redirect - Submit
18.  Dropdown list (combobox) in a form
19.  dropdown list (combobox) in form 2
20.  Disable or enable an option
21.  Disable and enable a dropdown list (combobox)
22.  Return the name of the form that contains dropdown list (combobox)
23.  Number of options in the dropdown list(Combobox)
24.  Change the size of a dropdown list (ComboBox)
25.  Select multiple options in a dropdown list (option)
26.  Return the selected option as text in option
27.  Return the selected option as a number
28.  Change the option text
29.  Remove an option from a dropdown list (combobox)
30.  Methods and Properties of the Select Object
31.  Properties of the Option Object
32.   Using the Location object to change another frame's URL
33.  Navigating with a SELECT Object
34.  Using the selectedIndex Property
35.   Modifying OPTGROUP Element Labels
36.  Using the options[index].text Property
37.   Using the options[index].value Property
38.  Triggering a Color Change from a Pop-Up Menu
39.  Modifying SELECT Options
40.  Modifying SELECT Options (IE4+)
41.  Modifying SELECT Options (NN6+)
42.  Selecting an Option Using JavaScript
43.  Linked ComboBox (option) Country =- province
44.  ComboBox set value to TextField
45.  Menu(Option) Generator
46.  URL Option ComboBox
47.  Show Selected Option items
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.