| Author |
us JavaScript submit button to submit a form?
|
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
Hello, I have big trouble figuring this out. I am very new to JavaScript. Here is what I need to do, Use the following button to submit my struts form: Really need to be enlightened on this. regards
|
 |
poornima balagopal
Ranch Hand
Joined: Dec 02, 2003
Posts: 83
|
|
Hi, if you are using html tags for your jsp or to submit your page you can do like this first write a function like as followsin java script in the head tag. /* function for submit */ function submitType() { document.forms[0].submit(); } call the function in the onclick of the button.use normal button than submit button . if you specify any name for your form then give the same in the function class instead of forms[0].submit(); forms[0] will be set if there no name for form . it will take the first form. Hope this will help you all the best
|
 |
rick collette
Ranch Hand
Joined: Mar 22, 2002
Posts: 208
|
|
Thank you very much for your reply. I will try your advice. Unfortunately my submit button is auto-generated like the following. There is no name and value for it. Basically, I wish I can send the form and be forwarded to one of dispatch action methods, "process". Can this be achieved? regards,
|
 |
David Yutzy
tumbleweed and gunslinger
Ranch Hand
Joined: Jun 29, 2001
Posts: 192
|
|
I have a hidden field on the form called "method", then use javascript to dynamically change this value to the dispatch method you want to call. something like (in the onClick event of the button):
|
 |
 |
|
|
subject: us JavaScript submit button to submit a form?
|
|
|