You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edvin Syse <ed...@sysedata.no> on 2007/12/26 21:35:46 UTC

Which way to go? AjaxSubmitLink or AjaxLink? Neither does the job for me :)

Hi,

I have a form where some of the components have validators (Required, EmailValidator etc). The form uses CompoundPropertyModel for my 
object. Upon entering some text in one input field and clicking a button, a ModalWindow opens and shows a searchresult based on the input.

The button is a AjaxSubmitLink. The problem is that this operation is performed BEFORE the rest of the form is filled out, so validation 
fails (since lots of fields are missing input at this stage), and the ModalWindow doesn't open. If I turn off validation everything is good, 
but I need the validation for when the form is complete and finally submitted :)

If I change to an AjaxLink, I can get the ModalWindow to open, but then the input data isn't propagated to the model, so I can't get hold of 
it in the ModalWindow. I have also tried overriding getDefaultFormProcessing() and returning false, but then obviously the model isn't 
updated either, so I'm stuck.

Maybe I'm going about this the wrong way.. Any suggestions? Should I use another form without validation just for this one textfield?

Sincerely,
Edvin Syse

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Which way to go? AjaxSubmitLink or AjaxLink? Neither does the job for me :)

Posted by ed...@sysedata.no.
> Yes indeed. You could open a JIRA issue with your use case and a proposal.
>
>       Erik.

I added an RFE for it now:

https://issues.apache.org/jira/browse/WICKET-1247

-- Edvin

> Edvin Syse wrote:
>> Thanks, that's a good option :) I went with rearranging the layout and
>> using two forms, but I think a getDefaultFormValidation() method would
>> be a nice addition to the framework :)
>>
>> -- Edvin
>>
>
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
>
> ---------------------------------------------------------------------
> 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: Which way to go? AjaxSubmitLink or AjaxLink? Neither does the job for me :)

Posted by Erik van Oosten <e....@grons.nl>.
Yes indeed. You could open a JIRA issue with your use case and a proposal.

      Erik.

Edvin Syse wrote:
> Thanks, that's a good option :) I went with rearranging the layout and
> using two forms, but I think a getDefaultFormValidation() method would
> be a nice addition to the framework :)
>
> -- Edvin
>

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Which way to go? AjaxSubmitLink or AjaxLink? Neither does the job for me :)

Posted by Edvin Syse <ed...@sysedata.no>.
Thanks, that's a good option :) I went with rearranging the layout and 
using two forms, but I think a getDefaultFormValidation() method would 
be a nice addition to the framework :)

-- Edvin

Erik van Oosten skrev:
> Another option is to attach onchange handlers to all components (with an
> ajax behavior).
> 
> You can optionally do validation in the handler and contineously show
> validation errors as the user leaves an input field.
> 
> Regards,
>     Erik.
> 
> 
>>> Edvin Syse wrote:
>>>> Hi,
>>>>
>>>> I have a form where some of the components have validators (Required,
>>>> EmailValidator etc). The form uses CompoundPropertyModel for my
>>>> object. Upon entering some text in one input field and clicking a
>>>> button,
>>>> a ModalWindow opens and shows a searchresult based on the input.
>>>>
>>>> The button is a AjaxSubmitLink. The problem is that this operation is
>>>> performed BEFORE the rest of the form is filled out, so validation
>>>> fails (since lots of fields are missing input at this stage), and the
>>>> ModalWindow doesn't open. If I turn off validation everything is
>>>> good, but I need the validation for when the form is complete and
>>>> finally
>>>> submitted :)
>>>>
>>>> If I change to an AjaxLink, I can get the ModalWindow to open, but then
>>>> the input data isn't propagated to the model, so I can't get hold of
>>>> it in the ModalWindow. I have also tried overriding
>>>> getDefaultFormProcessing() and returning false, but then obviously the
>>>> model isn't updated either, so I'm stuck.
>>>>
>>>> Maybe I'm going about this the wrong way.. Any suggestions? Should I
>>>> use
>>>> another form without validation just for this one textfield?
>>>>
>>>> Sincerely,
>>>> Edvin Syse
> 
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
> 
> 
> ---------------------------------------------------------------------
> 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: Which way to go? AjaxSubmitLink or AjaxLink? Neither does the job for me :)

Posted by Erik van Oosten <e....@grons.nl>.
Another option is to attach onchange handlers to all components (with an
ajax behavior).

You can optionally do validation in the handler and contineously show
validation errors as the user leaves an input field.

Regards,
    Erik.


>>
>> Edvin Syse wrote:
>>> Hi,
>>>
>>> I have a form where some of the components have validators (Required,
>>> EmailValidator etc). The form uses CompoundPropertyModel for my
>>> object. Upon entering some text in one input field and clicking a
>>> button,
>>> a ModalWindow opens and shows a searchresult based on the input.
>>>
>>> The button is a AjaxSubmitLink. The problem is that this operation is
>>> performed BEFORE the rest of the form is filled out, so validation
>>> fails (since lots of fields are missing input at this stage), and the
>>> ModalWindow doesn't open. If I turn off validation everything is
>>> good, but I need the validation for when the form is complete and
>>> finally
>>> submitted :)
>>>
>>> If I change to an AjaxLink, I can get the ModalWindow to open, but then
>>> the input data isn't propagated to the model, so I can't get hold of
>>> it in the ModalWindow. I have also tried overriding
>>> getDefaultFormProcessing() and returning false, but then obviously the
>>> model isn't updated either, so I'm stuck.
>>>
>>> Maybe I'm going about this the wrong way.. Any suggestions? Should I
>>> use
>>> another form without validation just for this one textfield?
>>>
>>> Sincerely,
>>> Edvin Syse
>

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Which way to go? AjaxSubmitLink or AjaxLink? Neither does the job for me :)

Posted by Edvin Syse <ed...@sysedata.no>.
> Why not make it 2 separated forms?

Beause of the layout that would mean nesting two forms, and I'm not sure 
how that works out in different browsers. I might have to go that way, 
but wouldn't it be nice/possible to skip validation but still bind the 
model object changes with getDefaultFormValidation() == false or 
something like that?

-- Edvin

> 
> 
> 
> Edvin Syse wrote:
>> Hi,
>>
>> I have a form where some of the components have validators (Required,
>> EmailValidator etc). The form uses CompoundPropertyModel for my 
>> object. Upon entering some text in one input field and clicking a button,
>> a ModalWindow opens and shows a searchresult based on the input.
>>
>> The button is a AjaxSubmitLink. The problem is that this operation is
>> performed BEFORE the rest of the form is filled out, so validation 
>> fails (since lots of fields are missing input at this stage), and the
>> ModalWindow doesn't open. If I turn off validation everything is good, 
>> but I need the validation for when the form is complete and finally
>> submitted :)
>>
>> If I change to an AjaxLink, I can get the ModalWindow to open, but then
>> the input data isn't propagated to the model, so I can't get hold of 
>> it in the ModalWindow. I have also tried overriding
>> getDefaultFormProcessing() and returning false, but then obviously the
>> model isn't 
>> updated either, so I'm stuck.
>>
>> Maybe I'm going about this the wrong way.. Any suggestions? Should I use
>> another form without validation just for this one textfield?
>>
>> Sincerely,
>> Edvin Syse
>>
>> ---------------------------------------------------------------------
>> 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: Which way to go? AjaxSubmitLink or AjaxLink? Neither does the job for me :)

Posted by Thijs <vo...@gmail.com>.
Why not make it 2 separated forms?



Edvin Syse wrote:
> 
> Hi,
> 
> I have a form where some of the components have validators (Required,
> EmailValidator etc). The form uses CompoundPropertyModel for my 
> object. Upon entering some text in one input field and clicking a button,
> a ModalWindow opens and shows a searchresult based on the input.
> 
> The button is a AjaxSubmitLink. The problem is that this operation is
> performed BEFORE the rest of the form is filled out, so validation 
> fails (since lots of fields are missing input at this stage), and the
> ModalWindow doesn't open. If I turn off validation everything is good, 
> but I need the validation for when the form is complete and finally
> submitted :)
> 
> If I change to an AjaxLink, I can get the ModalWindow to open, but then
> the input data isn't propagated to the model, so I can't get hold of 
> it in the ModalWindow. I have also tried overriding
> getDefaultFormProcessing() and returning false, but then obviously the
> model isn't 
> updated either, so I'm stuck.
> 
> Maybe I'm going about this the wrong way.. Any suggestions? Should I use
> another form without validation just for this one textfield?
> 
> Sincerely,
> Edvin Syse
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Which-way-to-go--AjaxSubmitLink-or-AjaxLink--Neither-does-the-job-for-me-%3A%29-tp14506161p14507376.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org