Hi,
I want to submit the combo box when i hit the enter button. How do i do that?
i tried with the following code but it doesn’t work.
var serienummerCombo=dhtmlXComboFromSelect(“serienummer”);
serienummerCombo.enableFilteringMode(true, “loadComboSerienummer.php”);
serienummerCombo.attachEvent(“onKeyPressed”, function(e){
if (!e) var e = window.event;
if (e.keyCode == 13) {
var state = serienummerCombo.DOMelem_hidden_input2.value;//state is true if input doesnt exist & false if exist in the list
if (state){
document.form2.submit();
}else{
alert(‘bla’);
}
}
});
this code worked with the previous version of the combobox but i have upgraded to v1.2. How do i get this to work with the new version?
Nasir
In the latest combo version, “onKeyPressed” event handler gets as a parameter the keyCode, not the event.
Please, try to use the following:
serienummerCombo.attachEvent(“onKeyPressed”, function(keyCode){
if (e.keyCode == 13) {
var state =
serienummerCombo.DOMelem_hidden_input2.value;//state is true if input
doesnt exist & false if exist in the list
if (state){
document.form2.submit();
}else{
alert(‘bla’);
}
}
});