You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dan Kaplan <dk...@citizenhawk.com> on 2008/05/09 01:02:28 UTC

Javascript adding input

Let's say that hypothetically I used javascript to add an <input> to a
form in its onload method.  How can I get wicket to become aware of that
input so I can do things like validate it, etc.?  


Re: Javascript adding input

Posted by Maurice Marrink <ma...@gmail.com>.
>  You need
>  these hidden fields to tell the recaptcha server what it gave you so it
>  can compare it to what the user typed in.  Without them, it can't tell
>  you if the user entered things in correctly or not.

I guess storing that information in the user session is out of the question?

Maurice

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


Re: Javascript adding input

Posted by James Carman <ja...@carmanconsulting.com>.
On Mon, May 12, 2008 at 8:39 PM, Dan Kaplan <dk...@citizenhawk.com> wrote:
> I do use that.  This has nothing to do with ReCaptcha, this is a "How do
> I do x in Wicket" question that someone asked, "Why would you want to do
> that?" so I used ReCaptcha as an answer.

Ok, gotcha.  So, we're not talking about ReCaptcha anymore?  You just
want to know how you could have some JavaScript run onload that
displays input elements that are tied to Wicket components?  Why do
you need to use JavaScript?  Are you writing the JavaScript?

If I were going to go about this, I would perhaps try to do what
ImageMap does.  It creates components and adds them to itself.  Then
it calls getPage().componentRendered() so that Wicket knows that
they've already been rendered.  Then, your JavaScript needs to use the
ids that Wicket generates in the document.write().  Now this is
assuming that you have some control over the JavaScript (you need to
dynamically generate it, obviously).  As, Maurice pointed out, there
are better ways of doing this (using Velocity to generate the markup
would be easier IMHO if this is really what you want).

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


RE: Javascript adding input

Posted by Dan Kaplan <dk...@citizenhawk.com>.
I do use that.  This has nothing to do with ReCaptcha, this is a "How do
I do x in Wicket" question that someone asked, "Why would you want to do
that?" so I used ReCaptcha as an answer.  

> -----Original Message-----
> From: jcarman@carmanconsulting.com
[mailto:jcarman@carmanconsulting.com]
> On Behalf Of James Carman
> Sent: Monday, May 12, 2008 3:47 PM
> To: users@wicket.apache.org
> Subject: Re: Javascript adding input
> 
> Have you looked at the Recaptcha Java plugin?  It might give you an
> example of how to create a Recaptcha component.  I'm actually thinking
> about playing around with this myself.  Recaptcha seems pretty cool.
> I'll let you know if I come up with anything.
> 
> On Mon, May 12, 2008 at 1:57 PM, Dan Kaplan <dk...@citizenhawk.com>
> wrote:
> > Ok, that's the only way I know how too.  I was hoping there is
another
> > way
> >
> >> -----Original Message-----
> >> From: snooplsm@gmail.com [mailto:snooplsm@gmail.com] On Behalf Of
Ryan
> >> Gravener
> >> Sent: Friday, May 09, 2008 12:52 PM
> >> To: users@wicket.apache.org
> >> Subject: Re: Javascript adding input
> >>
> >> Get the hidden data from the request:
> >> getRequest().getParameter("hidden_token");
> >>
> >> On Fri, May 9, 2008 at 2:13 PM, Dan Kaplan
<dk...@citizenhawk.com>
> >> wrote:
> >>
> >> > That's not the point, but if you need a good reason how about
this:
> > I'm
> >> > using recaptcha (it generates a captcha on the page).  It works
by
> >> > putting a script tag where you want it to show up.  When the page
> > loads,
> >> > it puts a text input field and a bunch of hidden fields there.
You
> > need
> >> > these hidden fields to tell the recaptcha server what it gave you
so
> > it
> >> > can compare it to what the user typed in.  Without them, it can't
> > tell
> >> > you if the user entered things in correctly or not.
> >> >
> >> > > -----Original Message-----
> >> > > From: Maurice Marrink [mailto:marrink@gmail.com]
> >> > > Sent: Friday, May 09, 2008 12:24 AM
> >> > > To: users@wicket.apache.org
> >> > > Subject: Re: Javascript adding input
> >> > >
> >> > > Why would you want to do that?
> >> > > If it happens at form load you must know about this inputfield
> > when
> >> > > you create the page so why not add a wicket component for it
too?
> >> > >
> >> > > Maurice
> >> > >
> >> > > On Fri, May 9, 2008 at 1:02 AM, Dan Kaplan
> > <dk...@citizenhawk.com>
> >> > > wrote:
> >> > > > Let's say that hypothetically I used javascript to add an
> > <input> to
> >> > a
> >> > > > form in its onload method.  How can I get wicket to become
aware
> > of
> >> > that
> >> > > > input so I can do things like validate it, etc.?
> >> > > >
> >> > > >
> >> > >
> >> > >
> >
---------------------------------------------------------------------
> >> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > > For additional commands, e-mail: users-help@wicket.apache.org
> >> > >
> >> >
> >> >
> >> >
> >> >
> >
---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >>
> >> --
> >> Ryan Gravener
> >> http://twitter.com/ryangravener
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



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


Re: Javascript adding input

Posted by James Carman <ja...@carmanconsulting.com>.
Have you looked at the Recaptcha Java plugin?  It might give you an
example of how to create a Recaptcha component.  I'm actually thinking
about playing around with this myself.  Recaptcha seems pretty cool.
I'll let you know if I come up with anything.

On Mon, May 12, 2008 at 1:57 PM, Dan Kaplan <dk...@citizenhawk.com> wrote:
> Ok, that's the only way I know how too.  I was hoping there is another
> way
>
>> -----Original Message-----
>> From: snooplsm@gmail.com [mailto:snooplsm@gmail.com] On Behalf Of Ryan
>> Gravener
>> Sent: Friday, May 09, 2008 12:52 PM
>> To: users@wicket.apache.org
>> Subject: Re: Javascript adding input
>>
>> Get the hidden data from the request:
>> getRequest().getParameter("hidden_token");
>>
>> On Fri, May 9, 2008 at 2:13 PM, Dan Kaplan <dk...@citizenhawk.com>
>> wrote:
>>
>> > That's not the point, but if you need a good reason how about this:
> I'm
>> > using recaptcha (it generates a captcha on the page).  It works by
>> > putting a script tag where you want it to show up.  When the page
> loads,
>> > it puts a text input field and a bunch of hidden fields there.  You
> need
>> > these hidden fields to tell the recaptcha server what it gave you so
> it
>> > can compare it to what the user typed in.  Without them, it can't
> tell
>> > you if the user entered things in correctly or not.
>> >
>> > > -----Original Message-----
>> > > From: Maurice Marrink [mailto:marrink@gmail.com]
>> > > Sent: Friday, May 09, 2008 12:24 AM
>> > > To: users@wicket.apache.org
>> > > Subject: Re: Javascript adding input
>> > >
>> > > Why would you want to do that?
>> > > If it happens at form load you must know about this inputfield
> when
>> > > you create the page so why not add a wicket component for it too?
>> > >
>> > > Maurice
>> > >
>> > > On Fri, May 9, 2008 at 1:02 AM, Dan Kaplan
> <dk...@citizenhawk.com>
>> > > wrote:
>> > > > Let's say that hypothetically I used javascript to add an
> <input> to
>> > a
>> > > > form in its onload method.  How can I get wicket to become aware
> of
>> > that
>> > > > input so I can do things like validate it, etc.?
>> > > >
>> > > >
>> > >
>> > >
> ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > > For additional commands, e-mail: users-help@wicket.apache.org
>> > >
>> >
>> >
>> >
>> >
> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>>
>> --
>> Ryan Gravener
>> http://twitter.com/ryangravener
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


RE: Javascript adding input

Posted by Dan Kaplan <dk...@citizenhawk.com>.
Ok, that's the only way I know how too.  I was hoping there is another
way

> -----Original Message-----
> From: snooplsm@gmail.com [mailto:snooplsm@gmail.com] On Behalf Of Ryan
> Gravener
> Sent: Friday, May 09, 2008 12:52 PM
> To: users@wicket.apache.org
> Subject: Re: Javascript adding input
> 
> Get the hidden data from the request:
> getRequest().getParameter("hidden_token");
> 
> On Fri, May 9, 2008 at 2:13 PM, Dan Kaplan <dk...@citizenhawk.com>
> wrote:
> 
> > That's not the point, but if you need a good reason how about this:
I'm
> > using recaptcha (it generates a captcha on the page).  It works by
> > putting a script tag where you want it to show up.  When the page
loads,
> > it puts a text input field and a bunch of hidden fields there.  You
need
> > these hidden fields to tell the recaptcha server what it gave you so
it
> > can compare it to what the user typed in.  Without them, it can't
tell
> > you if the user entered things in correctly or not.
> >
> > > -----Original Message-----
> > > From: Maurice Marrink [mailto:marrink@gmail.com]
> > > Sent: Friday, May 09, 2008 12:24 AM
> > > To: users@wicket.apache.org
> > > Subject: Re: Javascript adding input
> > >
> > > Why would you want to do that?
> > > If it happens at form load you must know about this inputfield
when
> > > you create the page so why not add a wicket component for it too?
> > >
> > > Maurice
> > >
> > > On Fri, May 9, 2008 at 1:02 AM, Dan Kaplan
<dk...@citizenhawk.com>
> > > wrote:
> > > > Let's say that hypothetically I used javascript to add an
<input> to
> > a
> > > > form in its onload method.  How can I get wicket to become aware
of
> > that
> > > > input so I can do things like validate it, etc.?
> > > >
> > > >
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> 
> --
> Ryan Gravener
> http://twitter.com/ryangravener


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


Re: Javascript adding input

Posted by Ryan Gravener <ry...@ryangravener.com>.
Get the hidden data from the request:
getRequest().getParameter("hidden_token");

On Fri, May 9, 2008 at 2:13 PM, Dan Kaplan <dk...@citizenhawk.com> wrote:

> That's not the point, but if you need a good reason how about this: I'm
> using recaptcha (it generates a captcha on the page).  It works by
> putting a script tag where you want it to show up.  When the page loads,
> it puts a text input field and a bunch of hidden fields there.  You need
> these hidden fields to tell the recaptcha server what it gave you so it
> can compare it to what the user typed in.  Without them, it can't tell
> you if the user entered things in correctly or not.
>
> > -----Original Message-----
> > From: Maurice Marrink [mailto:marrink@gmail.com]
> > Sent: Friday, May 09, 2008 12:24 AM
> > To: users@wicket.apache.org
> > Subject: Re: Javascript adding input
> >
> > Why would you want to do that?
> > If it happens at form load you must know about this inputfield when
> > you create the page so why not add a wicket component for it too?
> >
> > Maurice
> >
> > On Fri, May 9, 2008 at 1:02 AM, Dan Kaplan <dk...@citizenhawk.com>
> > wrote:
> > > Let's say that hypothetically I used javascript to add an <input> to
> a
> > > form in its onload method.  How can I get wicket to become aware of
> that
> > > input so I can do things like validate it, etc.?
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Ryan Gravener
http://twitter.com/ryangravener

RE: Javascript adding input

Posted by Dan Kaplan <dk...@citizenhawk.com>.
That's not the point, but if you need a good reason how about this: I'm
using recaptcha (it generates a captcha on the page).  It works by
putting a script tag where you want it to show up.  When the page loads,
it puts a text input field and a bunch of hidden fields there.  You need
these hidden fields to tell the recaptcha server what it gave you so it
can compare it to what the user typed in.  Without them, it can't tell
you if the user entered things in correctly or not.

> -----Original Message-----
> From: Maurice Marrink [mailto:marrink@gmail.com]
> Sent: Friday, May 09, 2008 12:24 AM
> To: users@wicket.apache.org
> Subject: Re: Javascript adding input
> 
> Why would you want to do that?
> If it happens at form load you must know about this inputfield when
> you create the page so why not add a wicket component for it too?
> 
> Maurice
> 
> On Fri, May 9, 2008 at 1:02 AM, Dan Kaplan <dk...@citizenhawk.com>
> wrote:
> > Let's say that hypothetically I used javascript to add an <input> to
a
> > form in its onload method.  How can I get wicket to become aware of
that
> > input so I can do things like validate it, etc.?
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



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


Re: Javascript adding input

Posted by Maurice Marrink <ma...@gmail.com>.
Why would you want to do that?
If it happens at form load you must know about this inputfield when
you create the page so why not add a wicket component for it too?

Maurice

On Fri, May 9, 2008 at 1:02 AM, Dan Kaplan <dk...@citizenhawk.com> wrote:
> Let's say that hypothetically I used javascript to add an <input> to a
> form in its onload method.  How can I get wicket to become aware of that
> input so I can do things like validate it, etc.?
>
>

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