You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tito <nj...@gmail.com> on 2010/10/19 01:45:31 UTC

Button submit and onclick event right way

Hello everybody!
This is a question of what is the right way to do this.

The idea is, I'm submiting information with a submit button from a form. But
at the same time I want to send another information (generated by
javascript) by ajax. Is clear what I'm trying to do?

Well at this time I have made a behavior that I'm atatching to my webpage,
that process one call made by ajax with wicketAjaxGet function in witch part
of information travel. And at the same time process the rest of information
by onSubmit method after form submitting.

I hope I explained well. I just wanna now what is the correct way to do
this.

Thanks a lot.

Bye
Tito

Re: Button submit and onclick event right way

Posted by Tito <nj...@gmail.com>.
So, you say that I could put information in some hidden fields?

In that case I suppose doesn't matter if I submit by ajax or a simple http
request.
I think I could use Hidden Fields, but I didn't realize before.

Thanks!

2010/10/18 jcgarciam <jc...@gmail.com>

>
> Well without knowing much detail of your implementation i could say, you
> need to use one of the function wicketAjaxGet or wicketAjaxPost to actually
> post the content of your form to wicket. In the server side depending on
> how
> you have setup your Model or set your hidden fields in the html form you
> can
> retrieve later your field by using:
>
> Not a very orthodoxy way:
> WebRequest.get().getRequestParameter("yourHiddendFieldName")
>
> On Mon, Oct 18, 2010 at 10:55 PM, Tito [via Apache Wicket] <
> ml-node+3001345-678496819-65838@n4.nabble.com<ml...@n4.nabble.com>
> <ml...@n4.nabble.com>
> >
> > wrote:
>
> > mmm good question...
> >
> > In fact I wanted to do that. But I couldn't found the way to send all
> > information in one request. I don't know how to send that information
> that
> > I
> > get with javascript.
> >
> > 2010/10/18 jcgarciam <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3001345&i=0>>
> >
> >
> > >
> > > Just by curiosity why not sending all information in one request (on
> form
> >
> > > submit), rather than two separate http request?
> > >
> > > You can leave the onclick of your button to submit your form via
> > javascript
> > > which also previously massage the additional data you need.
> > >
> > >
> > > On Mon, Oct 18, 2010 at 8:46 PM, Tito [via Apache Wicket] <
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=1
> ><[hidden
> > email] <http://user/SendEmail.jtp?type=node&node=3001345&i=2>>
> > > <[hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=3
> ><[hidden
> > email] <http://user/SendEmail.jtp?type=node&node=3001345&i=4>>
> > > >
> > > > wrote:
> > >
> > > > Hello everybody!
> > > > This is a question of what is the right way to do this.
> > > >
> > > > The idea is, I'm submiting information with a submit button from a
> > form.
> > > > But
> > > > at the same time I want to send another information (generated by
> > > > javascript) by ajax. Is clear what I'm trying to do?
> > > >
> > > > Well at this time I have made a behavior that I'm atatching to my
> > > webpage,
> > > > that process one call made by ajax with wicketAjaxGet function in
> witch
> >
> > > > part
> > > > of information travel. And at the same time process the rest of
> > > information
> > > >
> > > > by onSubmit method after form submitting.
> > > >
> > > > I hope I explained well. I just wanna now what is the correct way to
> do
> >
> > > > this.
> > > >
> > > > Thanks a lot.
> > > >
> > > > Bye
> > > > Tito
> > > >
> > > >
> > > > ------------------------------
> > > >  View message @
> > > >
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001276.html
> <
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001276.html?by-user=t
> >
> > > > To start a new topic under Apache Wicket, email
> > > > [hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=5
> ><[hidden
> > email] <http://user/SendEmail.jtp?type=node&node=3001345&i=6>>
> > > <[hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=7
> ><[hidden
> > email] <http://user/SendEmail.jtp?type=node&node=3001345&i=8>>
> > > >
> > > > To unsubscribe from Apache Wicket, click here<
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=
> <
> http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t
> >
> > > >.
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Sincerely,
> > > JC (http://www.linkedin.com/in/jcgarciam)
> > > Work smarter, not harder!.
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001327.html
> <
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001327.html?by-user=t
> >
> > > Sent from the Users forum mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=3001345&i=9>
> > > For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=3001345&i=10>
> > >
> > >
> >
> >
> > ------------------------------
> >  View message @
> >
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001345.html
> > To start a new topic under Apache Wicket, email
> > ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
> <ml...@n4.nabble.com>
> >
> > To unsubscribe from Apache Wicket, click here<
> http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=
> >.
> >
> >
> >
>
>
> --
> Sincerely,
> JC (http://www.linkedin.com/in/jcgarciam)
> Work smarter, not harder!.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001367.html
> Sent from the Users forum 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: Button submit and onclick event right way

Posted by jcgarciam <jc...@gmail.com>.
Well without knowing much detail of your implementation i could say, you
need to use one of the function wicketAjaxGet or wicketAjaxPost to actually
post the content of your form to wicket. In the server side depending on how
you have setup your Model or set your hidden fields in the html form you can
retrieve later your field by using:

Not a very orthodoxy way:
WebRequest.get().getRequestParameter("yourHiddendFieldName")

On Mon, Oct 18, 2010 at 10:55 PM, Tito [via Apache Wicket] <
ml-node+3001345-678496819-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> mmm good question...
>
> In fact I wanted to do that. But I couldn't found the way to send all
> information in one request. I don't know how to send that information that
> I
> get with javascript.
>
> 2010/10/18 jcgarciam <[hidden email]<http://user/SendEmail.jtp?type=node&node=3001345&i=0>>
>
>
> >
> > Just by curiosity why not sending all information in one request (on form
>
> > submit), rather than two separate http request?
> >
> > You can leave the onclick of your button to submit your form via
> javascript
> > which also previously massage the additional data you need.
> >
> >
> > On Mon, Oct 18, 2010 at 8:46 PM, Tito [via Apache Wicket] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=1><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=3001345&i=2>>
> > <[hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=3><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=3001345&i=4>>
> > >
> > > wrote:
> >
> > > Hello everybody!
> > > This is a question of what is the right way to do this.
> > >
> > > The idea is, I'm submiting information with a submit button from a
> form.
> > > But
> > > at the same time I want to send another information (generated by
> > > javascript) by ajax. Is clear what I'm trying to do?
> > >
> > > Well at this time I have made a behavior that I'm atatching to my
> > webpage,
> > > that process one call made by ajax with wicketAjaxGet function in witch
>
> > > part
> > > of information travel. And at the same time process the rest of
> > information
> > >
> > > by onSubmit method after form submitting.
> > >
> > > I hope I explained well. I just wanna now what is the correct way to do
>
> > > this.
> > >
> > > Thanks a lot.
> > >
> > > Bye
> > > Tito
> > >
> > >
> > > ------------------------------
> > >  View message @
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001276.html<http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001276.html?by-user=t>
> > > To start a new topic under Apache Wicket, email
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=5><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=3001345&i=6>>
> > <[hidden email] <http://user/SendEmail.jtp?type=node&node=3001345&i=7><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=3001345&i=8>>
> > >
> > > To unsubscribe from Apache Wicket, click here<
> >
> http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=&by-user=t>
> > >.
> > >
> > >
> > >
> >
> >
> > --
> > Sincerely,
> > JC (http://www.linkedin.com/in/jcgarciam)
> > Work smarter, not harder!.
> >
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001327.html<http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001327.html?by-user=t>
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=3001345&i=9>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=3001345&i=10>
> >
> >
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001345.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001367.html
Sent from the Users forum 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: Button submit and onclick event right way

Posted by Tito <nj...@gmail.com>.
mmm good question...

In fact I wanted to do that. But I couldn't found the way to send all
information in one request. I don't know how to send that information that I
get with javascript.

2010/10/18 jcgarciam <jc...@gmail.com>

>
> Just by curiosity why not sending all information in one request (on form
> submit), rather than two separate http request?
>
> You can leave the onclick of your button to submit your form via javascript
> which also previously massage the additional data you need.
>
>
> On Mon, Oct 18, 2010 at 8:46 PM, Tito [via Apache Wicket] <
> ml-node+3001276-352039908-65838@n4.nabble.com<ml...@n4.nabble.com>
> <ml...@n4.nabble.com>
> >
> > wrote:
>
> > Hello everybody!
> > This is a question of what is the right way to do this.
> >
> > The idea is, I'm submiting information with a submit button from a form.
> > But
> > at the same time I want to send another information (generated by
> > javascript) by ajax. Is clear what I'm trying to do?
> >
> > Well at this time I have made a behavior that I'm atatching to my
> webpage,
> > that process one call made by ajax with wicketAjaxGet function in witch
> > part
> > of information travel. And at the same time process the rest of
> information
> >
> > by onSubmit method after form submitting.
> >
> > I hope I explained well. I just wanna now what is the correct way to do
> > this.
> >
> > Thanks a lot.
> >
> > Bye
> > Tito
> >
> >
> > ------------------------------
> >  View message @
> >
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001276.html
> > To start a new topic under Apache Wicket, email
> > ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
> <ml...@n4.nabble.com>
> >
> > To unsubscribe from Apache Wicket, click here<
> http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=
> >.
> >
> >
> >
>
>
> --
> Sincerely,
> JC (http://www.linkedin.com/in/jcgarciam)
> Work smarter, not harder!.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001327.html
> Sent from the Users forum 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: Button submit and onclick event right way

Posted by jcgarciam <jc...@gmail.com>.
Just by curiosity why not sending all information in one request (on form
submit), rather than two separate http request?

You can leave the onclick of your button to submit your form via javascript
which also previously massage the additional data you need.


On Mon, Oct 18, 2010 at 8:46 PM, Tito [via Apache Wicket] <
ml-node+3001276-352039908-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> Hello everybody!
> This is a question of what is the right way to do this.
>
> The idea is, I'm submiting information with a submit button from a form.
> But
> at the same time I want to send another information (generated by
> javascript) by ajax. Is clear what I'm trying to do?
>
> Well at this time I have made a behavior that I'm atatching to my webpage,
> that process one call made by ajax with wicketAjaxGet function in witch
> part
> of information travel. And at the same time process the rest of information
>
> by onSubmit method after form submitting.
>
> I hope I explained well. I just wanna now what is the correct way to do
> this.
>
> Thanks a lot.
>
> Bye
> Tito
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001276.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Button-submit-and-onclick-event-right-way-tp3001276p3001327.html
Sent from the Users forum 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