M
Megha Vishwanath
Hi,
I have a struts form <html:form> in which although the focus rests on
the submit button, hitting the enter key does not submit the form.
I tried capturing the Enter key event and followed it by the
document.form.submit() but this takes me through the validation
attached with the submit twice( giving me all the alerts twice).
Here's the code
function validate()
{
var validateVal = isValidated();//this guy does all the validation
if(!validateVal)
{
return false;
}
else
{
document.CustSearchFormBean.submit();
}
}
function checkKeyPressed()
{
if(window.event.keyCode=="13")
{
validate();
}
}
I call validate
a)for the enter button through <BODY onkeypress=checkKeyPressed();
b)for the mouseclick submit through <html:submit onclick=validate();
This may be a whole pointless workaround. Does Struts support
something more elegant?
Any solutions?
Thanks and Regards,
Megha
I have a struts form <html:form> in which although the focus rests on
the submit button, hitting the enter key does not submit the form.
I tried capturing the Enter key event and followed it by the
document.form.submit() but this takes me through the validation
attached with the submit twice( giving me all the alerts twice).
Here's the code
function validate()
{
var validateVal = isValidated();//this guy does all the validation
if(!validateVal)
{
return false;
}
else
{
document.CustSearchFormBean.submit();
}
}
function checkKeyPressed()
{
if(window.event.keyCode=="13")
{
validate();
}
}
I call validate
a)for the enter button through <BODY onkeypress=checkKeyPressed();
b)for the mouseclick submit through <html:submit onclick=validate();
This may be a whole pointless workaround. Does Struts support
something more elegant?
Any solutions?
Thanks and Regards,
Megha