You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Pich <pe...@edb.com> on 2007/07/02 13:52:32 UTC

Required attribute for multiple elements

Hi!

Does anybody know if it is possible to put a required constraint on a group
of elements on a JSF page? E.g. I have a page for register a transfer. It is
mandatory to select one from account, enter an amount and select one to
account. However, my problem is that the user can select to account from
three different lists. I use the required attribute on from account and
amount. So my question is if it is possible to group these to account lists
in on group and put a coinstraint that a selection must be made from at
least on of these lists.

Best regards

Pich
-- 
View this message in context: http://www.nabble.com/Required-attribute-for-multiple-elements-tf4011733.html#a11392572
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Required attribute for multiple elements

Posted by Vladimir Isakovich <iv...@gmail.com>.
I've not got to dealing with aproblem like this yet, but this will
inevitably happen to me in the near future.
This is a general issue with a group edit, when two or more fields have some
inter-dependancies.
In this case I'd attach a ValueChangeListener to all components in the
group, pointing them to one method in the managed bean, and then in that
method have the logic for the group-edit, grabbing all group components and
analizing their values.
Also, you may want to add a flag for preventing your logic working more than
once per request (in case more then one field value was changed and several
listeners fired).

vlad


On 7/2/07, Pich <pe...@edb.com> wrote:
>
>
> Hi!
>
> Does anybody know if it is possible to put a required constraint on a
> group
> of elements on a JSF page? E.g. I have a page for register a transfer. It
> is
> mandatory to select one from account, enter an amount and select one to
> account. However, my problem is that the user can select to account from
> three different lists. I use the required attribute on from account and
> amount. So my question is if it is possible to group these to account
> lists
> in on group and put a coinstraint that a selection must be made from at
> least on of these lists.
>
> Best regards
>
> Pich
> --
> View this message in context:
> http://www.nabble.com/Required-attribute-for-multiple-elements-tf4011733.html#a11392572
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>