You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by dshapi <Da...@giant-steps.com> on 2008/11/26 12:27:09 UTC

triggering post of a for from client side

hi,
I need to trigger the post of a form - from the client side with java script
, but all the solutions that i have found don't work with wicket.
i have tried " document.forms['commentForm'].submit(); " in script ->
doesn't work.
(when commentForm is the name of the form that is generated in the mark up
of the wicket ).

i all sow tried to trigger the  submit button that is in the form but
".click()" doesn't work, 
i have managed only to  trigger Links with window.location = link.href;

any ideas ?
 

-- 
View this message in context: http://www.nabble.com/triggering-post-of-a-for-from-client-side-tp20699113p20699113.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: triggering post of a form, from client side

Posted by dshapi <Da...@giant-steps.com>.
thanks for your quick replay . so the situation as it is now is :
i have managed to call the forms submit by the following java script :
"
StringBuffer config = new StringBuffer();
int i = ns.getAutoRefreshSecsConversation();

config.append("<script language=\"JavaScript\">");
config.append("function onLoad() { getValue(); "+ ( i<0 ?
"":"setTimeout(\"onRefresh();\","+i*1000+"); ")+ "}");
config.append("function onRefresh(){");
config.append("document.getElementById('hiddenVar').value = 
document.getElementById('textString').value;");
config.append("var button = document.getElementById('" +
submit.getMarkupId() + "');" +
		  "window.location = button.click(); }" );
config.append("function getValue() {");
config.append("document.getElementById('textString').value =
document.getElementById('hiddenVar').value; }");
config.append("</script>");

add(new StringHeaderContributor(config.toString()));


BUT... the result i get it the fire fox is this :
i get the data posted to the server side correctly BUT im as well redirected
to the link- 
http://localhost:6789/neustar/undefined
and i get HTTP Status 404 - /neustar/undefined

what do i do now how ? why does that happen instead of the normal behavior
of submit button like clicking it in the browser?!

Regards.,
 

jwcarman wrote:
> 
> You may want to look at AjaxFormSubmitBehavior.  If you can't use that
> directly, the code might give you an idea of how to write your Javascript
> to
> do form submissions manually.
> 
> On Wed, Nov 26, 2008 at 6:27 AM, dshapi
> <Da...@giant-steps.com>wrote:
> 
>>
>> hi,
>> I need to trigger the post of a form - from the client side with java
>> script
>> , but all the solutions that i have found don't work with wicket.
>> i have tried " document.forms['commentForm'].submit(); " in script ->
>> doesn't work.
>> (when commentForm is the name of the form that is generated in the mark
>> up
>> of the wicket ).
>>
>> i all sow tried to trigger the  submit button that is in the form but
>> ".click()" doesn't work,
>> i have managed only to  trigger Links with window.location = link.href;
>>
>> any ideas ?
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/triggering-post-of-a-form%2C-from-client-side-tp20699113p20699113.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
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/triggering-post-of-a-form%2C-from-client-side-tp20699113p20756255.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: triggering post of a form, from client side

Posted by James Carman <ja...@carmanconsulting.com>.
You may want to look at AjaxFormSubmitBehavior.  If you can't use that
directly, the code might give you an idea of how to write your Javascript to
do form submissions manually.

On Wed, Nov 26, 2008 at 6:27 AM, dshapi <Da...@giant-steps.com>wrote:

>
> hi,
> I need to trigger the post of a form - from the client side with java
> script
> , but all the solutions that i have found don't work with wicket.
> i have tried " document.forms['commentForm'].submit(); " in script ->
> doesn't work.
> (when commentForm is the name of the form that is generated in the mark up
> of the wicket ).
>
> i all sow tried to trigger the  submit button that is in the form but
> ".click()" doesn't work,
> i have managed only to  trigger Links with window.location = link.href;
>
> any ideas ?
>
>
> --
> View this message in context:
> http://www.nabble.com/triggering-post-of-a-form%2C-from-client-side-tp20699113p20699113.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
>
>