I have raised a bug in JIRA for this: https://issues.apache.org/jira/browse/TAP5-2254
On 5 December 2013 22:22, Balázs Palcsó <palcso.bal...@gmail.com> wrote: > I forgot to post the definition of @Validate("password") which makes the > password field the first required field in the form (and making it to owner > of the focus on the form) > > @Contribute(ValidatorMacro.*class*) > > *public* *static* *void* > combinePasswordValidators(*final*MappedConfiguration<String, String> > configuration) { > > configuration.add("password", "required,minlength=5,maxlength=50,regexp="+ > ValidationConstants. > *PASSWORD_REGEXP*); > > } > > > > > On 5 December 2013 21:43, Balázs Palcsó <palcso.bal...@gmail.com> wrote: > >> Hi All, >> >> I have the following BeanEditForm: >> >> <t:beaneditform t:id=*"userRegistrationForm"* t:object=*"user"* >> t:submitLabel="${message:registrationButton-label}" >> >> include= >> *"username,lastName,firstName,email,phone,password,confirmPassword,newsletter"* >> > >> >> </t:beaneditform> >> >> Backed by a User class with these properties: >> >> @NotNull >> >> @NotBlank >> >> @Size(min = 3, max = 30) >> >> *private* String firstName; >> >> >> @NotNull >> >> @NotBlank >> >> @Size(min = 3, max = 30) >> >> *private* String lastName; >> >> >> @NotNull >> >> @NotBlank >> >> @Size(min = 3, max = 20) >> >> @Pattern(regexp = ValidationConstants.*USERNAME_REGEXP*, message = >> "{com.ajanlatotkapok.user.User.username-pattern-message}") >> >> *private* String username; >> >> >> @NotNull >> >> @NotBlank >> >> @Email >> >> *private* String email; >> >> >> @Pattern(regexp = ValidationConstants.*PHONE_NUMBER_REGEXP*, message = >> "{phone-regexp-message}") >> >> @Size(min = 9, max = 20) >> >> *private* String phone; >> >> >> @Validate("password") >> >> @Transient >> >> *private* String password; >> >> >> @Validate("password") >> >> @Transient >> >> *private* String confirmPassword; >> >> By default the autofocus is enabled for the BeanEditForm and it seems >> that only tapestry's @Validate fields are considered when determining which >> field is the first required field on the form ignoring @NotNull and >> @NotBlank JSR-303 annotations. >> >> As a workaround I can annotate all required fields >> with @Validate("required"), though I would prefer to stick with only >> JSR-303 where I can. >> >> Shall I raise a bug in JIRA? >> >> Thanks and regards, >> Balazs Palcso >> >> >> >> >