You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2008/06/21 10:55:36 UTC
DropDownChoice and Raw Input values (of e.g., textfields)
Hi!
Is there a simple way to make DropDownChoice.onChange behave in a
manner somewhat similar to an
AjaxFallbackButton.setDefaultFormProcessing(false).onClick?
I have a dropDown and a textField. They are both within a PANEL that
gets AjaxRefreshed whenever the dropdown choice is changed.
The problem is, that even though I re-use the textField, it does not
know its convertedInput (probably because the form has not actually
been submitted?) and it resets itself to its original state. I would
like it to keep its state as it was when the new dropdown value was
selected.
Currently both textField.getConvertedInput and textField.getInput are
null... "All I need" is to attach some defaultFormProcessing(false)
behavoir to the dropDown (and the form submit, ofcourse) ;)
**
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DropDownChoice and Raw Input values (of e.g., textfields)
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
>> The problem is, that even though I re-use the textField, it does not
>> know its convertedInput (probably because the form has not actually
>> been submitted?) and it resets itself to its original state. I would
>> like it to keep its state as it was when the new dropdown value was
>> selected.
>
> Have you tried AjaxFormComponentUpdatingBehavior?
Will this sumit all form components?
> The easiest case is when you can submit always and save the
> data when there are no errors.
The problem is, that the form is filled partially and more options
became available depending on the dropdownchoices made. This means
that at early stages the form is erroneous.
Now I use the AjaxFormSubmitBehavior and override the onError ->
onSubmit, i.e., I effectively ignore all errors during these events. I
would be glad if I could skip the validation alltogether.
The necessary feature I get with AjaxFormSubmitBehavior, is that it
will send the dirty values of the form components so that when they
are repainted, they reflect their state just before the ajax event. I
wonder if AjaxFormComponentUpdatingBehavior will do the same or will
it submit only one component? I think I would need an
"AjaxFormUpdatingBehavior", i.e., update the whole form's state
whithout passing values into the model/validation. This is similar to
Button's "defaultFormProcessing=false".
I could ofcourse add a hidden button which is called whenever the
dropdownchoice is changed, but I would rather implement this in java.
**
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DropDownChoice and Raw Input values (of e.g., textfields)
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Sat, 21 Jun 2008, Martin Makundi wrote:
> The problem is, that even though I re-use the textField, it does not
> know its convertedInput (probably because the form has not actually
> been submitted?) and it resets itself to its original state. I would
> like it to keep its state as it was when the new dropdown value was
> selected.
Have you tried AjaxFormComponentUpdatingBehavior?
When you repaint something via Ajax, the whole HTML of the
repainted components comes from the server, so you will lose
whatever information was not submitted to server.
The easiest case is when you can submit always and save the
data when there are no errors. But if your requirements are
more complicated, you might need to do some hacks in onSubmit
or onError.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: DropDownChoice and Raw Input values (of e.g., textfields)
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
AjaxFormValidatingBehavior extends AjaxFormSubmitBehavior. I do not
need the feedback update, so I tried AjaxFormSubmitBehavior.
The problem is that AjaxFormSubmitBehavior actually submits the form
(executes my form.onSubmit which actually tries to save the form when
still incomplete!!).
I can work around this by analyzing which button submitted the form
(and if null -> do not save):
myform = new Form(..) {
protected void onSubmit() {
super.onSubmit();
if (findSubmittingButton() != null) {
// do actual save here
}
}
}
It seems like a hack :) Should I just roll with this solution?
**
Martin
2008/6/21 Stefan Lindner <li...@visionet.de>:
> Maybe the AjaxFormValidatingBehavior is what you need.
>
> -----Ursprüngliche Nachricht-----
> Von: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
> Gesendet: Samstag, 21. Juni 2008 10:56
> An: users@wicket.apache.org
> Betreff: DropDownChoice and Raw Input values (of e.g., textfields)
>
> Hi!
>
> Is there a simple way to make DropDownChoice.onChange behave in a manner somewhat similar to an AjaxFallbackButton.setDefaultFormProcessing(false).onClick?
>
> I have a dropDown and a textField. They are both within a PANEL that gets AjaxRefreshed whenever the dropdown choice is changed.
>
> The problem is, that even though I re-use the textField, it does not know its convertedInput (probably because the form has not actually been submitted?) and it resets itself to its original state. I would like it to keep its state as it was when the new dropdown value was selected.
>
> Currently both textField.getConvertedInput and textField.getInput are null... "All I need" is to attach some defaultFormProcessing(false) behavoir to the dropDown (and the form submit, ofcourse) ;)
>
> **
> Martin
>
> ---------------------------------------------------------------------
> 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: DropDownChoice and Raw Input values (of e.g., textfields)
Posted by Stefan Lindner <li...@visionet.de>.
Maybe the AjaxFormValidatingBehavior is what you need.
-----Ursprüngliche Nachricht-----
Von: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
Gesendet: Samstag, 21. Juni 2008 10:56
An: users@wicket.apache.org
Betreff: DropDownChoice and Raw Input values (of e.g., textfields)
Hi!
Is there a simple way to make DropDownChoice.onChange behave in a manner somewhat similar to an AjaxFallbackButton.setDefaultFormProcessing(false).onClick?
I have a dropDown and a textField. They are both within a PANEL that gets AjaxRefreshed whenever the dropdown choice is changed.
The problem is, that even though I re-use the textField, it does not know its convertedInput (probably because the form has not actually been submitted?) and it resets itself to its original state. I would like it to keep its state as it was when the new dropdown value was selected.
Currently both textField.getConvertedInput and textField.getInput are null... "All I need" is to attach some defaultFormProcessing(false) behavoir to the dropDown (and the form submit, ofcourse) ;)
**
Martin
---------------------------------------------------------------------
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