webtekie
07-25-2003, 09:19 AM
Hello,
I found this DHTML object that allows regular comboBox to be searchable. Script also submits values for the form to itself. However, I can't get a new field that I've added (text field) to submit its value -- it's always empty. Any help is appreciated.
here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>ComboBox Form Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<script src="include/ComboBox.js"></script>
<script>
function go(){
document.getElementsByName('combobox')[0].value = poShipVia.value;
document.getElementsByName('field').value = testfield.value;
document.getElementById('test-form').submit();
}
</script>
<form id="test-form">
<input type="hidden" name="combobox"/>
<input type="hidden" name="field"/>
</form>
<p>Select shipping type:</p>
<p id="shipviacell">
<script type="text/javascript" language="JavaScript">
var poShipVia = new ComboBox("poShipVia", document.getElementById("shipviacell"));
poShipVia.add(new ComboBoxItem("FedEx","FedEx"));
poShipVia.add(new ComboBoxItem("UPS","UPS"));
poShipVia.add(new ComboBoxItem("US Postal Service","US Postal Service"));
</script>
</p>
<br>
<p id="testfield">
<input type="text" name="testfield">
</p>
<br>
<br>
<p>
<button onclick="javascript:go()">Submit</button>
</p>
</body>
</html>
P.S. The source code for enitre object is here http://webfx.nu/dhtml/combobox/
I found this DHTML object that allows regular comboBox to be searchable. Script also submits values for the form to itself. However, I can't get a new field that I've added (text field) to submit its value -- it's always empty. Any help is appreciated.
here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>ComboBox Form Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<script src="include/ComboBox.js"></script>
<script>
function go(){
document.getElementsByName('combobox')[0].value = poShipVia.value;
document.getElementsByName('field').value = testfield.value;
document.getElementById('test-form').submit();
}
</script>
<form id="test-form">
<input type="hidden" name="combobox"/>
<input type="hidden" name="field"/>
</form>
<p>Select shipping type:</p>
<p id="shipviacell">
<script type="text/javascript" language="JavaScript">
var poShipVia = new ComboBox("poShipVia", document.getElementById("shipviacell"));
poShipVia.add(new ComboBoxItem("FedEx","FedEx"));
poShipVia.add(new ComboBoxItem("UPS","UPS"));
poShipVia.add(new ComboBoxItem("US Postal Service","US Postal Service"));
</script>
</p>
<br>
<p id="testfield">
<input type="text" name="testfield">
</p>
<br>
<br>
<p>
<button onclick="javascript:go()">Submit</button>
</p>
</body>
</html>
P.S. The source code for enitre object is here http://webfx.nu/dhtml/combobox/