New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend o:validateOrder to provide optional attribute #47

Closed
pholding opened this Issue Jul 21, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@pholding

pholding commented Jul 21, 2014

Would it be possible to extend the o:validateOrder component to provide an optional attribute so that if any of the client IDs specified in the components attribute contain a null value then the validation is skipped. The use case I've got is a form that has a start date and end date component both of which are optional and the user can popuate either or both components, and I would only like the o:validateOrder component to execute its validation if both start and end date components have been populated.

Whilst not needed in my use case another useful extension would be to include an o:validateOrder component which is based on o:validateAllOrNone

@BalusC

This comment has been minimized.

Show comment
Hide comment
@BalusC

BalusC Jul 22, 2014

Member

You could use the disabled attribute for that.

<x:inputDate id="start" binding="#{start}" />
<x:inputDate id="end" binding="#{end}" />
<o:validateOrder components="start end" disabled="#{empty start.value or empty end.value}" />
Member

BalusC commented Jul 22, 2014

You could use the disabled attribute for that.

<x:inputDate id="start" binding="#{start}" />
<x:inputDate id="end" binding="#{end}" />
<o:validateOrder components="start end" disabled="#{empty start.value or empty end.value}" />

@BalusC BalusC closed this in 61aae0d Aug 9, 2014

@BalusC

This comment has been minimized.

Show comment
Hide comment
@BalusC

BalusC Aug 9, 2014

Member

After a thought, I decided to remove nulls (and empty strings) from to-be-validated values. This responsibility should be up to the required="true" or @NotNull/@NotBlank.

The change is available in today's 2.0 snapshot https://oss.sonatype.org/content/repositories/snapshots/org/omnifaces/omnifaces/2.0-SNAPSHOT/ (which requires JSF 2.2 / CDI 1.0 though). Please give it a try.

Member

BalusC commented Aug 9, 2014

After a thought, I decided to remove nulls (and empty strings) from to-be-validated values. This responsibility should be up to the required="true" or @NotNull/@NotBlank.

The change is available in today's 2.0 snapshot https://oss.sonatype.org/content/repositories/snapshots/org/omnifaces/omnifaces/2.0-SNAPSHOT/ (which requires JSF 2.2 / CDI 1.0 though). Please give it a try.

BalusC added a commit that referenced this issue Aug 18, 2014

Fix #47: Skip null/empty values in o:validateOrder (this job is actually
up to required="true")

Conflicts:
	src/main/java/org/omnifaces/component/validator/ValidateOrder.java
	src/main/java/org/omnifaces/util/Utils.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment