You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andrea Aime <aa...@opengeo.org> on 2009/06/19 13:21:53 UTC
Getting form component raw value on ajax action
Hi,
I have a form in which one of the fields represents a server
side path. The field has a validator to make sure the path is
valid and contains certain kind of files inside of it.
I also have a link on the side of it that opens in a modal
window a server side file system browser to be used as a
directory chooser.
The issue is, I would like to know what the user typed in
the field, use it in the chooser, and when I'm done with
the chooser, update the value in the field accordingly.
I've tried out three solutions, none of them seems to work:
- plain ajaxsubmitlink: validation triggers and onSubmit does
not get called all the time. Not good
- ajajxsubmitlink + disable default form processing + grab
the field input value -> the chooser starts with whatever
the user typed in, but when the chooser closes it
would seem the field is not updated even if it's
part of the ajax request target and its model has
been updated
- ajaxlink: the opposite, that is the form field value
cannot be read (it's not posted back to the server)
but when the chooser closes the field value is updated
with whatever the user chose (the code that does
the field update is exactly the same)
Sigh... any way to have this thing work both ways?
I can provide sample code, but first I'd like to check if
there is any general reason why this would not work.
Cheers
Andrea
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Getting form component raw value on ajax action
Posted by Andrea Aime <aa...@opengeo.org>.
Andrea Aime ha scritto:
> Hi,
> I have a form in which one of the fields represents a server
> side path. The field has a validator to make sure the path is
> valid and contains certain kind of files inside of it.
>
> I also have a link on the side of it that opens in a modal
> window a server side file system browser to be used as a
> directory chooser.
>
> The issue is, I would like to know what the user typed in
> the field, use it in the chooser, and when I'm done with
> the chooser, update the value in the field accordingly.
>
> I've tried out three solutions, none of them seems to work:
> - plain ajaxsubmitlink: validation triggers and onSubmit does
> not get called all the time. Not good
> - ajajxsubmitlink + disable default form processing + grab
> the field input value -> the chooser starts with whatever
> the user typed in, but when the chooser closes it
> would seem the field is not updated even if it's
> part of the ajax request target and its model has
> been updated
Answering myself, the second option works provided that
the code calls field.clearInput() (besides setting the
new model value).
Cheers
Andrea
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Getting form component raw value on ajax action
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Have a look at autocomplete texxtfield, it should provide a good starting point.
**
Martin
2009/6/19 Andrea Aime <aa...@opengeo.org>:
> Hi,
> I have a form in which one of the fields represents a server
> side path. The field has a validator to make sure the path is
> valid and contains certain kind of files inside of it.
>
> I also have a link on the side of it that opens in a modal
> window a server side file system browser to be used as a
> directory chooser.
>
> The issue is, I would like to know what the user typed in
> the field, use it in the chooser, and when I'm done with
> the chooser, update the value in the field accordingly.
>
> I've tried out three solutions, none of them seems to work:
> - plain ajaxsubmitlink: validation triggers and onSubmit does
> not get called all the time. Not good
> - ajajxsubmitlink + disable default form processing + grab
> the field input value -> the chooser starts with whatever
> the user typed in, but when the chooser closes it
> would seem the field is not updated even if it's
> part of the ajax request target and its model has
> been updated
> - ajaxlink: the opposite, that is the form field value
> cannot be read (it's not posted back to the server)
> but when the chooser closes the field value is updated
> with whatever the user chose (the code that does
> the field update is exactly the same)
>
> Sigh... any way to have this thing work both ways?
> I can provide sample code, but first I'd like to check if
> there is any general reason why this would not work.
>
> Cheers
> Andrea
>
> ---------------------------------------------------------------------
> 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