This content has been marked as final.
Show 4 replies
-
1. Re: validating that at least one of n fields are not null on submission of form
lvdberg Jun 10, 2009 9:46 AM (in response to gonorrhea)Arbi,
This kind of
cross-property
validation is best done in a action or Home component where you add theses business rules., using a valueChangeListenetr or including ajax-support tags if you're using thestandard
elements.Leo
-
2. Re: validating that at least one of n fields are not null on submission of form
gonorrhea Jun 10, 2009 5:03 PM (in response to gonorrhea)Thx for the reply. I have used <a4j:support event="onblur"> in the past with Seam validators.
In this case, it's not a dynamic (live) validation, so I did the following for the search action method in my SFSB:
public void search(){ //first check to see if item number, recovery status, equipment type are null; requirement is at least one of them to be non-null upon submission... if ( (itemNumber == null || itemNumber.equals("")) && selectedListValueForRecoveryStatus == null && selectedListValueForEquipmentType == null) facesMessages.add(FacesMessage.SEVERITY_ERROR, "You must input at least one of the following fields: item number, recovery status, equipment type", null); else { //continue processing getData(); } }
-
3. Re: validating that at least one of n fields are not null on submission of form
lvdberg Jun 10, 2009 5:23 PM (in response to gonorrhea)This is what I meant.
We are trying to solve a similar problem with uniqueness of beans. As oon as we have something re-usable, we will send it to this forum.Leo
-
4. Re: validating that at least one of n fields are not null on submission of form
coralfe Jul 22, 2009 4:36 PM (in response to gonorrhea)As per the el solution here you could probably
use a similar el expression using or.Something like
<h:inputText value="#{userCRUD.selectedRow.username}" size="30" required="#{!empty param['user_addEditForm:field1'] or !empty param['user_addEditForm:field1\2']}" id="user"/>