Hi,

On Thu, Oct 30, 2014 at 11:57 PM, Garret Wilson <gar...@globalmentor.com>
wrote:

> Andrea, thanks for jolting my brain; I was a little sleepy this morning.
>
> I was using a subclass of AjaxLink that added confirmation JavaScript as I
> outlined below. My original HTML was:
>
>     <button wicket:id="foo" type="submit">
>
> The root of the problem is that Wicket kept turning that into:
>
>     <button wicket:id="foo" type="button" id="foo7">
>
> Thus even though I got a confirmation dialog, the FileUpload was never
> being populated because the form was never being submitted.
>
> It turns out that apparently I have to use a subclass of AjaxSubmitLink
> rather than AjaxLink if I want the form to actually be submitted, even
> though I specified type="submit" in the HTML. So my immediate problem is
> solved.
>
> On a higher level, though, it means that I now have to go create a
> ConfirmationAjaxSubmitLink along with my ConfirmationAjaxLink. I would have
> thought/hoped that things like "submission" and "confirmation" were
> something that could be injected to various components using behaviors
> rather that subclassing all over the place.
>

There is a way to provide a global #updateAjaxAttributes() that is called
for each and every Ajax
behavior: 
org.apache.wicket.ajax.AjaxRequestTarget.IListener#updateAjaxAttributes

With
https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commit;h=d1caec5e
I've improved it so there is no need to cast it
to AbstractDefaultAjaxBehavior in the application code. You can use
AbstractDefaultAjaxBehavior#getComponent() to check whether you should
contribute to the ajax attributes or nor.


>
> But for now the program is working. Thanks again, Andrea, for asking the
> right question that made me investigate further in the right spot.
>
> Garret
>
>
> On 10/30/2014 1:14 PM, Andrea Del Bene wrote:
>
>> On 30/10/14 17:57, Garret Wilson wrote:
>>
>>> All,
>>>
>>> I've created a simple confirmation link based on Sven Meier's
>>> ConfirmationLink code <https://cwiki.apache.org/confluence/x/X4U> on
>>> Confluence. For the most part it works, but...
>>>
>>> ...but if I'm on an upload form, then an an Ajax link won't work because
>>> I need to actually submit the multipart information.
>>>
>>>
>>>  Hi,
>>
>> not sure I've got your problem. Are you submitting a form using a Ajax
>> link?
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to