10-31-2008, 09:25 PM
Hello,
In my web page, I have an Input field with two events (onkeyup and onchange) calling a javascript function.
This javascript checks if the size’s value is 5. If so, the form is submit and the same screen is display.
My problem : When I made a record, if I write 5 characters, the event is not recorded.
Remark : If I write 2 characters and I quit the field it’s OK.
My input field
My javascript
Thank's
In my web page, I have an Input field with two events (onkeyup and onchange) calling a javascript function.
This javascript checks if the size’s value is 5. If so, the form is submit and the same screen is display.
My problem : When I made a record, if I write 5 characters, the event is not recorded.
Remark : If I write 2 characters and I quit the field it’s OK.
My input field
Code:
<input type="text" name="codePostal" onkeyup="javascript:cpAction();" onchange="javascript:cpAction();">
My javascript
Code:
function cpAction(){
var cp = formulaire.elements['codePostal'].value
if( ((cp.length == 5) && (estValideCodePostal(cp))) || (cp.length == 0) ){
aValider = false;
formulaire.elements['reqCode'].value='display';
formulaire.submit();
}
}
Thank's