Perhaps the AjaxSubmitLink component have the behavior that you expect.
On Thu, Feb 25, 2010 at 9:00 PM, Igor Vaynberg <[email protected]>wrote:
> links do not transfer form values to the serverside, so you need to
> use a bit of js to do it for you. not sure exactly what your usecase
> is (sounds strange), but here goes off the top of my head:
>
> abstract class myuberlink extends link {
> private final textfield tf;
> public myuberlink(string id, textfield tf) { super(id);this.tf=tf;
> tf.setoutputmarkupid(true);}
> public void oncomponenttag(tag) {
>
>
> tag.put("onclick","this.href=this.href+'&"+tf.getinputname()+"='+document.getElementById('"+tf.getmarkupid()+"').value;
> return true;"); }
>
> public final void onclick() {
> onclick(getrequest().getattribute(tf.getinputname()); }
>
> protected abstract void onclick(string value);
> }
>
> -igor
>
> On Thu, Feb 25, 2010 at 3:51 PM, Tony Wu <[email protected]> wrote:
> > Is there a way to get a TextField's value without submitting the form?
> For
> > example, if I have a TextField and a Link (not a submit Button), I want
> the
> > Link's onClick to System.out.println the TextField's value at that time.
> I
> > tried using TextField.getInput, getConvertedInput, no dice on both.
> >
> > I even tried adding a AjaxFormComponentUpdatingBehavior to the TextField
> for
> > "onchange", which does work to change the TextField's model whenever a
> user
> > types something, but it's getInput and getConvertedInput is always null
> when
> > I click the Link. Even if the AjaxFormComponentUpdatingBehavior's
> onUpdate I
> > do TextField.setConvertedInput(model's new value) explicity, both
> getInput
> > and getConvertedInput are both null.
> >
> > Any ideas?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
[]s,
Victor Dolirio