...

View Full Version : Form Submission issue



rathe_8387
11-23-2012, 07:00 AM
Hi
I have a scenario like having two textbox A & B in a form

From "A" textbox if i press "Enter" key it should submit the form
Form "B" textbox if i press "Enter" key it should call another javascript method which willwill be calling a <href> url.

Issue : for my for two text box if i press "Enter" key it is submitting a form.

Please any one give me the solution .it will be great .........

Thanks,
Rajesh

Philip M
11-23-2012, 08:09 AM
Here you are:-



A <input type = "text" id = "boxA" onkeydown ="if (event.keyCode == 13) {checkit(this)} ">
<br>
B <input type = "text" id = "boxB" onkeydown ="if (event.keyCode == 13) {checkit(this)} ">

<script type = "text/javascript">

function checkit(which) {
var boxid = which.id;
if (boxid == "boxA") {
// do this
}
if (boxid == "boxB") {
// do that
}
}

</script>




"The only thing to do with good advice is pass it on. It is never any use to oneself."- Oscar Wilde (Irish Poet, Novelist, Dramatist and Critic, 1854-1900)

rathe_8387
11-26-2012, 12:42 PM
Thanks for our reply

if i have "Submit Button" or <input type="image"/>inside the form it is not working.

Instead i have a <a > tag its working.

if u have solution for the above case ,please share it.

Regards,
Rajesh.

Philip M
11-26-2012, 01:29 PM
Thanks for our reply

if i have "Submit Button" or <input type="image"/>inside the form it is not working.

Instead i have a <a > tag its working.

if u have solution for the above case ,please share it.

Regards,
Rajesh.

Sorry, I don't understand you. You said you had two textboxes. You did not mention a submit button, which will of course submit the form regardless.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum