Igor, for now I'm concerned about how can I make sure that my code that
mimics form submitting lifecycles and wicket code in coming version do the
same things?
For instance the AjaxFormComponentUpdatingBehavior:
@Override
protected final void onEvent(final AjaxRequestTarget target)
{
final FormComponent<?> formComponent = getFormComponent();
if (getEvent().toLowerCase().equals("onblur") &&
disableFocusOnBlur())
{
target.focusComponent(null);
}
try
{
formComponent.inputChanged();
formComponent.validate();
if (formComponent.hasErrorMessage())
{
formComponent.invalid();
onError(target, null);
}
else
{
formComponent.valid();
if (getUpdateModel())
{
formComponent.updateModel();
}
onUpdate(target);
}
}
catch (RuntimeException e)
{
onError(target, e);
}
}
I should do something similar but for the list of components the behavior
takes.
If the coming version of Wicket does it a bit different I would have to
insert a fork in my code that does version check:
switch(wicketVersion) {
case ...:
case ...:
}
If wicket sources had the form processing code extracted into utility class
I would employ it and be sure it should work in the new wicket version.
igor.vaynberg wrote:
>
> you can see how the submit behavior does it and replicate the parts
> you need. all these things are not using some magical internal apis.
> you are meant to build your own things when the default
> implementations do not do what you want.
>
> -igor
>
> On Tue, Jul 7, 2009 at 6:35 AM, Thierry Leveque<[email protected]> wrote:
>> Thanks, but I was not talking about using the submit behavior.
>>
>> I was talking about the way to create my own ajax behavior to send the
>> value
>> of multiple form fields.
>>
>> I think this should be part of Wicket. It is not the first time I
>> encounter
>> this problem. The first time, I found a workaround but this time I am
>> stuck.
>> There should be a simple way to create an ajax behavior that will send
>> the
>> values from the form components we want. Maybe with the option to
>> validate
>> them or not.
>> What do you think?
>>
>> Thierry
>>
>>
>> 2009/7/7 Stefan Malmesjö <[email protected]>
>>
>>> I just realized that maybe you need to extend your validators, too, at
>>> least if you want your modelobject to be updated. And how you do that on
>>> a
>>> textfield that is required, I don't really know.
>>>
>>> Maybe that path is too complicated.
>>>
>>> /Stefan
>>>
>>> On 2009-07-06 22:55, Stefan Malmesjö wrote:
>>>
>>>> Could setting visibility for the FeedbackPanel to false until the form
>>>> has
>>>> been "properly" submitted with a press of a submit button work?
>>>>
>>>> /Stefan
>>>>
>>>> On Mon, Jul 6, 2009 at 8:42 PM, Thierry Leveque
>>>> <[email protected]<mailto:
>>>> [email protected]>> wrote:
>>>>
>>>> Any following on that?
>>>>
>>>> Daniel, have you been able to solve your problem? Did you wrote
>>>> your own
>>>> behavior?
>>>>
>>>> I have the same requirement as you and I am trying to find a quick
>>>> way to
>>>> solve my problem.
>>>>
>>>> Can someone point me to some examples on how to write my own Ajax
>>>> behavior?
>>>>
>>>> Thanks
>>>>
>>>> Thierry
>>>>
>>>>
>>>> On Tue, Jun 2, 2009 at 12:21, Igor Vaynberg
>>>> <[email protected] <mailto:[email protected]>> wrote:
>>>>
>>>> > well, if you do not want to *submit* the form then dont use
>>>> > ajaxformSUBMITbehavior :)
>>>> >
>>>> > with little work you can roll your own behavior that does a simple
>>>> > ajax get and appends whatever values you need from formcomponents
>>>> to
>>>> > the url. that way the form is not submitted and you have access
>>>> to the
>>>> > raw values.
>>>> >
>>>> > -igor
>>>> >
>>>> >
>>>> >
>>>> > On Tue, Jun 2, 2009 at 9:16 AM, dfernandez
>>>> > <[email protected]
>>>> <mailto:[email protected]>> wrote:
>>>> > >
>>>> > >
>>>> > > Yes, I know it is tricky, but the fact is I don't think I
>>>> would really
>>>> > need
>>>> > > type conversion in this case.
>>>> > >
>>>> > > I will try to explain myself. I have the following UI:
>>>> > >
>>>> > > |OPERATOR |V|
>>>> > >
>>>> > > |INPUT1="aBc" | |INPUT2="DeF" |
>>>> > >
>>>> > > ...being "OPERATOR" the DropDownChoice, and both INPUT1 and
>>>> INPUT2 two
>>>> > > TextFields (String TextFields, to be precise). Both INPUT1 and
>>>> INPUT2 are
>>>> > > required (when they are visible, of course).
>>>> > >
>>>> > > When I change the value on "OPERATOR", the UI will change,
>>>> hiding INPUT1
>>>> > and
>>>> > > INPUT2 but showing INPUT3, another TextField which should have
>>>> the same
>>>> > > contents that were on INPUT1 before:
>>>> > >
>>>> > > |OPERATOR |V|
>>>> > >
>>>> > > |INPUT3="aBc" |
>>>> > >
>>>> > > The problem is that, when changing OPERATOR, I need to read
>>>> the value
>>>> > from
>>>> > > INPUT1 to set it into INPUT3, but if INPUT2 is empty I will
>>>> receive a
>>>> > > validation message telling me that it is required... which it
>>>> is, but I
>>>> > just
>>>> > > want Wicket to validate that when I want to *really* submit
>>>> the form, and
>>>> > > not now that I am only changing the operator.
>>>> > >
>>>> > > Thanks.
>>>> > >
>>>> > > Regards,
>>>> > > Daniel.
>>>> > >
>>>> > >
>>>> > >
>>>> > >
>>>> > >
>>>> > > igor.vaynberg wrote:
>>>> > >>
>>>> > >> how are you planning on reading the other values? you cannot
>>>> access
>>>> > >> the model so you will have to call getinput(), are you also
>>>> planning
>>>> > >> on doing type conversion yourself then?
>>>> > >>
>>>> > >> -igor
>>>> > >>
>>>> > >> 2009/6/2 Daniel Fernández <[email protected]
>>>> <mailto:[email protected]>>:
>>>>
>>>> > >>> Hello,
>>>> > >>>
>>>> > >>> I have a form with a DropDownChoice, on which "onchange"
>>>> event I want
>>>> > to
>>>> > >>> update some form components. But I need to read data from
>>>> other fields
>>>> > of
>>>> > >>> the form for doing so, and so I added an
>>>> AjaxFormSubmitBehavior to the
>>>> > >>> DropDownChoice.
>>>> > >>>
>>>> > >>> My intention is to read the data from the drop down and from
>>>> the other
>>>> > >>> fields, and depending on these data, update some other
>>>> components...
>>>> > but
>>>> > >>> the
>>>> > >>> problem is that AjaxFormSubmitBehavior not only sends the
>>>> form data,
>>>> > but
>>>> > >>> also *validates it*, which I don't want (I don't want
>>>> validation
>>>> > messages
>>>> > >>> to
>>>> > >>> appear when changing the value of the drop down).
>>>> > >>>
>>>> > >>> If it where an AjaxButton I would be able to just
>>>> > >>> setDefaultFormProcessing(false), but I don't see anything
>>>> like that in
>>>> > >>> AjaxFormSubmitBehavior...
>>>> > >>>
>>>> > >>> Is there a way to do this?
>>>> > >>>
>>>> > >>> Regards,
>>>> > >>> Daniel.
>>>> > >>>
>>>> > >>
>>>> > >>
>>>>
>>>> ---------------------------------------------------------------------
>>>> > >> To unsubscribe, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>> > >> For additional commands, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>> > >>
>>>> > >>
>>>> > >>
>>>> > >
>>>> > > --
>>>> > > View this message in context:
>>>> >
>>>>
>>>> http://www.nabble.com/Can-I-make-AjaxFormSubmitBehavior-submit-raw-form-data-but-not--validate-it--tp23830542p23835836.html
>>>> > > Sent from the Wicket - User mailing list archive at Nabble.com.
>>>> > >
>>>> > >
>>>> > >
>>>>
>>>> ---------------------------------------------------------------------
>>>> > > To unsubscribe, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>> > > For additional commands, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>> > >
>>>> > >
>>>> >
>>>> >
>>>>
>>>> ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>> > For additional commands, e-mail: [email protected]
>>>> <mailto:[email protected]>
>>>> >
>>>> >
>>>>
>>>>
>>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Can-I-make-AjaxFormSubmitBehavior-submit-raw-form-data-but-not--validate-it--tp23830542p24387062.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]