Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Strange behavior with JSR 303 client-side validation and nested beans

$
0
0
Hi list,

I'm using JSR-303 annotations. When validating a field from the page class,
it works as expected, and client-side validation is correctly triggered.

Page.java:

@NotNull
@Property
private String firstName;

Page.tml:

<t:form t:id="fill">
<fieldset>
<t:label for="firstName" />
<t:textfield t:id="firstName" value="firstName"/>
</fieldset>

<fieldset>
<t:submit />
</fieldset>
</t:form>

If I submit the form, client-side validation tells me that first name
should not be empty.

If I try the same, but from a field of a nested bean, then only server-side
validation occurs, not client-side.

Page.java:

@Property
private Person person = new Person();

Page.tml:

<t:form t:id="fill" validate="person">
<fieldset>
<t:label for="firstName" />
<t:textfield t:id="firstName" value="person.firstName"/>
</fieldset>

<fieldset>
<t:submit />
</fieldset>
</t:form>

Person.java:

@NotNull
private String firstName;

I don' know if this was working with earlier versions.

Christian

Viewing all articles
Browse latest Browse all 5648

Trending Articles