You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by hjuturu <ha...@yahoo.com> on 2008/03/07 05:28:10 UTC

form submit using document.form.submit() in wicket

Hi All
I have a form in my html page . I am trying to simulate form submit from  
tag using onclick="document.myForm.submit();". The onSubmit() method my
wicket class doesnt get called when i do this. Do i have to use <input
type="submit"/> to achieve this. i am using   tag so that i can style the
buttons as required.

Thanks
Haritha

=== Here is the code i am using ======

<form wicket:id="myForm" id="myForm" method="post" style="margin:-5px 0px
0px 10px;">
<br>
<div>
    <label>To [Email]:</label><br><input type='text' wicket:id="to"
style="width:250px"/>
<div>
 document.myForm.submit();">Submit  
</div>
</form>
================================


-- 
View this message in context: http://www.nabble.com/form-submit-using-document.form.submit%28%29-in-wicket-tp15889727p15889727.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: form submit using document.form.submit() in wicket

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Thu, 06 Mar 2008, hjuturu wrote:
> I have a form in my html page . I am trying to simulate form submit from  
> tag using onclick="document.myForm.submit();". The onSubmit() method my
> wicket class doesnt get called when i do this. Do i have to use <input
> type="submit"/> to achieve this. i am using   tag so that i can style the
> buttons as required.

Do you get a JavaScript error?

> <form wicket:id="myForm" id="myForm" method="post" style="margin:-5px 0px
> 0px 10px;">
> <br>
> <div>
>     <label>To [Email]:</label><br><input type='text' wicket:id="to"
> style="width:250px"/>
> <div>
>  document.myForm.submit();">Submit  
> </div>

Probably Wicket overwrites the id of the form, and you should
explicitly call

  form.setOutputMarkupId(true).setMarkupId("myForm");

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org