You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Balázs Palcsó <pa...@gmail.com> on 2013/12/05 22:43:15 UTC
Fwd: BeanEditForm autofocus issue with JSR 303 validaiton mixed with
tapestry validation (Tapestry 5.4-alpha-29)
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
Re: BeanEditForm autofocus issue with JSR 303 validaiton mixed with
tapestry validation (Tapestry 5.4-alpha-29)
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sat, 07 Dec 2013 14:13:10 -0200, Balázs Palcsó
<pa...@gmail.com> wrote:
> I have raised a bug in JIRA for this:
> https://issues.apache.org/jira/browse/TAP5-2254
Thanks!
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
Help me spend a whole month working on Tapestry bug fixes and
improvements: http://igg.me/at/t5month
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: BeanEditForm autofocus issue with JSR 303 validaiton mixed with
tapestry validation (Tapestry 5.4-alpha-29)
Posted by Balázs Palcsó <pa...@gmail.com>.
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ó <pa...@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ó <pa...@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
>>
>>
>>
>>
>
Re: BeanEditForm autofocus issue with JSR 303 validaiton mixed with
tapestry validation (Tapestry 5.4-alpha-29)
Posted by Balázs Palcsó <pa...@gmail.com>.
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ó <pa...@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
>
>
>
>