You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Fe...@t-systems.com on 2008/12/17 10:57:43 UTC

required="true" on partial submit?

Hi,

 

On one of my pages I've got 2 tr:selectOneChoice boxes - box A and box
B. The content of box B depends on the selection of box B. I'm using
autoSubmit="true" for box A and partialTriggers="boxA" for box B. This
works perfect unless I'm setting the required="true" attribute for box
B. That causes a validation of the box B selection when a change in box
A occurs. Seperating both boxes with tr:subforms doesn't work with the
partialTriggers, so this is no solution.


Am I right in thinking that I can't use the required="true" attribute
for box B or did I overlook other ways to implement this? When it's not
possible to set the required="true" for box B this is no  problem for me
because I can validate all fields later, but I want to know it because I
don't like smelling code.

 

Thanks you and best regards

 

Felix


Re: required="true" on partial submit?

Posted by Andy Schwartz <an...@gmail.com>.
Hi Felix -

One approach to consider would be to set immediate="true" on
seelctOnceChoice A.  This will force it to be validated/updated before
all of the other non-immediate components.  Then, in your
valueChangeListener for selectOneChoice A, you should be able to call
FacesContext.renderResponse() to skip over validation/update of the
rest of the page - thus skipping over any required field validation.

BTW, there is a great wiki on the "immediate" attribute here:

http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works

Hope that helps!

Andy


On Wed, Dec 17, 2008 at 4:57 AM,  <Fe...@t-systems.com> wrote:
> Hi,
>
>
>
> On one of my pages I've got 2 tr:selectOneChoice boxes – box A and box B.
> The content of box B depends on the selection of box B. I'm using
> autoSubmit="true" for box A and partialTriggers="boxA" for box B. This works
> perfect unless I'm setting the required="true" attribute for box B. That
> causes a validation of the box B selection when a change in box A occurs.
> Seperating both boxes with tr:subforms doesn't work with the
> partialTriggers, so this is no solution.
>
> Am I right in thinking that I can't use the required="true" attribute for
> box B or did I overlook other ways to implement this? When it's not possible
> to set the required="true" for box B this is no  problem for me because I
> can validate all fields later, but I want to know it because I don't like
> smelling code.
>
>
>
> Thanks you and best regards
>
>
>
> Felix

Re: required="true" on partial submit?

Posted by Andy Schwartz <an...@gmail.com>.
Oh, woops, yep, tr:subform is a much convenient than  manually mucking
with the immediate attribute.  Thanks Andrew!

Andy

On Wed, Dec 17, 2008 at 11:08 AM, Andrew Robinson
<an...@gmail.com> wrote:
> Look at tr:subForm
>
> On Wed, Dec 17, 2008 at 2:57 AM,  <Fe...@t-systems.com> wrote:
>> Hi,
>>
>>
>>
>> On one of my pages I've got 2 tr:selectOneChoice boxes – box A and box B.
>> The content of box B depends on the selection of box B. I'm using
>> autoSubmit="true" for box A and partialTriggers="boxA" for box B. This works
>> perfect unless I'm setting the required="true" attribute for box B. That
>> causes a validation of the box B selection when a change in box A occurs.
>> Seperating both boxes with tr:subforms doesn't work with the
>> partialTriggers, so this is no solution.
>>
>> Am I right in thinking that I can't use the required="true" attribute for
>> box B or did I overlook other ways to implement this? When it's not possible
>> to set the required="true" for box B this is no  problem for me because I
>> can validate all fields later, but I want to know it because I don't like
>> smelling code.
>>
>>
>>
>> Thanks you and best regards
>>
>>
>>
>> Felix
>

Re: required="true" on partial submit?

Posted by Andrew Robinson <an...@gmail.com>.
Look at tr:subForm

On Wed, Dec 17, 2008 at 2:57 AM,  <Fe...@t-systems.com> wrote:
> Hi,
>
>
>
> On one of my pages I've got 2 tr:selectOneChoice boxes – box A and box B.
> The content of box B depends on the selection of box B. I'm using
> autoSubmit="true" for box A and partialTriggers="boxA" for box B. This works
> perfect unless I'm setting the required="true" attribute for box B. That
> causes a validation of the box B selection when a change in box A occurs.
> Seperating both boxes with tr:subforms doesn't work with the
> partialTriggers, so this is no solution.
>
> Am I right in thinking that I can't use the required="true" attribute for
> box B or did I overlook other ways to implement this? When it's not possible
> to set the required="true" for box B this is no  problem for me because I
> can validate all fields later, but I want to know it because I don't like
> smelling code.
>
>
>
> Thanks you and best regards
>
>
>
> Felix