| Author |
Urgent::Problem with Form submission,JS,Enter key
|
archana vishwanath
Ranch Hand
Joined: Mar 09, 2004
Posts: 39
|
|
Hi friends, Im facing problem with this code.My javascript here gets invoked with mouse press in the button,but not in Enter key. Can any body help me to sort out this.(i.e)If I invoke the form by directly hitting the keyboard enter button with out using mouse,my javascript is not getting invoked. This is my javascript --------------------- function arsubmit(){ if(document.frm1.T1.value==""){ document.frm1.T1.focus(); alert("Please enter Batch name"); return false; } else{ javascript ocument.frm1.submit(); } } Im using this to invoke my script Note onKlick="return arsubmit(); I have used Klick insted of click purposely because the javaranch server is not allowing me to submit the exact code
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
|
|
becasue onclick does not use the enter key! you need to use the onsubmit handler in the form tag <form name="blah" onsubmit=return jsFunction()"> return true to submit false to ignore with your function. P.S. Using Urgent makes me want to skip the question so do not use it in your title! Eric
|
 |
archana vishwanath
Ranch Hand
Joined: Mar 09, 2004
Posts: 39
|
|
SORRY & Thanks ERIC It worked. <form name =frm1 method=get action="AAA.jsp" onsubmit="return arsubmit();"> by this way.
|
 |
archana vishwanath
Ranch Hand
Joined: Mar 09, 2004
Posts: 39
|
|
ERIC I'm facing one more problem,I want to get the value of my submit button in my next page,which is not available when I use onsubmit method.Pls advice me how to overcome this. I need these submit values. input type="submit" name="stasubmit" value="Save & exit" input type="submit" name="stasubmit" value="Save & add new
|
 |
 |
|
|
subject: Urgent::Problem with Form submission,JS,Enter key
|
|
|