Hi Martin,
thanks for your reply, it definitely made my day! I had to tweak the
snippet a little, because Wicket.Form.serialize() returns an array of
objects that does not really work out for the AJAX request. So I changed
the value expression into Wicket.$(id).value and that worked perfectly.
Thanks a lot!
Christian
> Hi,
>
> The new way is to use the dynamic extra parameters.
> Each Ajax behavior and component has a method
> #updateAjaxAttributes(AjaxRequestAttributes attributes) :
>
> attributes.getDynamicExtraParameters().add("return [obj1, obj2, ...]").
>
> Where objN are JavaScript objects like: {"name":
> formComponent.getInputName(), "value":
> Wicket.Form.serialize(Wicket.$('"+formComponent.getMarkupId()+"')) }
>
> The above is a pseudo code but I hope you follow me.
>
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Mon, Apr 14, 2014 at 8:45 PM, Christian Smolka <
> [email protected]> wrote:
>
>> Hi to everybody!
>>
>> My little problem is about validating multiple input fields as a single
>> one.
>> So, I have three DoB fields (one for the day, one for the month and one
>> for the
>> year) that should be validated as a single date.
>>
>> While using Wicket 1.5 we overwrote AjaxEventBehavior#getEventHandler() and
>> returned a custom made JavaScript that serialized the three fields like
>> this:
>>
>>
>> StringBuffer buffer = new StringBuffer("wicketAjaxPost('")
>> .append(this.getCallbackUrl()).append("', ");
>> for (String id : this.getInputIds()) {
>> buffer.append("wicketSerialize(Wicket.$('").append(id).append("')) +
>> ");
>> }
>> buffer.setLength(buffer.length() - 3);
>> return buffer;
>>
>>
>> This worked pretty well. But I have to migrate the application to Wicket 6
>> and this doing does work anymore. As far as I understood the new Ajax-way,
>> it isn't possible anymore to provide a custom script like the one above.
>> But
>> how can I restore the old behavior? Do I have to put the fields into a
>> form and
>> submit the whole form to validate it?
>>
>> Thanks in advance!
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]