Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by TH on Dec 21, 2007 07:10
open dhtmlx forum
IE7-Problem with accessing value

When i use the ComboBox, i cant access the value via JavaScript in IE7. Firefox everything is ok.
sample:
...
<form name="angaben">
<select name="txtKennzeichen" id="idtxtHersteller" type="hidden" value="" >
<option>test</option>
</select>
</form>

<script type="text/javascript">
var zHerst=dhtmlXComboFromSelect("idtxtHersteller");
zHerst.loadXML("/json/kfzhersteller-xml.jsp");
</script>
<br/>
<a href="javascript:alert(document.angaben.txtKennzeichen.value)">test</a>

Clicking on test results in an error in IE7. txtKennzeichen is undefined
Answer posted by Support on Dec 21, 2007 09:43
In IE , elements dynamically added to form can't work the same as native ones, so in case of combo, while it is registered as part of form, it can't be accessed in the same way as original select.
You can use

<script type="text/javascript">
var zHerst=dhtmlXComboFromSelect("idtxtHersteller");
zHerst.loadXML("/json/kfzhersteller-xml.jsp");
</script>
<br/>
<a href="javascript:alert(zHerst.getActualValue())">test</a>