[5.4-beta-22] field-bound form validation messages

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[5.4-beta-22] field-bound form validation messages

Ilya Obshadko-2
I've found out that at some point (not sure, but probably after upgrade to
5.4-beta-22), custom form validation errors stopped displaying on related
fields. Effectively this breaks proper display of validation errors in any
form not using <t:errors/> component.

I'm wondering if this is already fixed in 5.4-beta-26?

--
Ilya Obshadko
Reply | Threaded
Open this post in threaded view
|

Re: [5.4-beta-22] field-bound form validation messages

JumpStart
I think you're seeing this bug: "Field-specific error not shown when AJAX used". It's been partially fixed in 5.4-beta-26, but there's still an issue.

        https://issues.apache.org/jira/browse/TAP5-2391

Geoff

On 13 Mar 2015, at 1:41 am, Ilya Obshadko <[hidden email]> wrote:

> I've found out that at some point (not sure, but probably after upgrade to
> 5.4-beta-22), custom form validation errors stopped displaying on related
> fields. Effectively this breaks proper display of validation errors in any
> form not using <t:errors/> component.
>
> I'm wondering if this is already fixed in 5.4-beta-26?
>
> --
> Ilya Obshadko

Reply | Threaded
Open this post in threaded view
|

Re: [5.4-beta-22] field-bound form validation messages

Ilya Obshadko-2
Yes, this is it. Any options besides reverting to beta-6 (which is highly
undesirable)?

On Sat, Mar 14, 2015 at 5:10 AM, Geoff Callender <
[hidden email]> wrote:

> I think you're seeing this bug: "Field-specific error not shown when AJAX
> used". It's been partially fixed in 5.4-beta-26, but there's still an issue.
>
>         https://issues.apache.org/jira/browse/TAP5-2391
>
> Geoff
>
> On 13 Mar 2015, at 1:41 am, Ilya Obshadko <[hidden email]> wrote:
>
> > I've found out that at some point (not sure, but probably after upgrade
> to
> > 5.4-beta-22), custom form validation errors stopped displaying on related
> > fields. Effectively this breaks proper display of validation errors in
> any
> > form not using <t:errors/> component.
> >
> > I'm wondering if this is already fixed in 5.4-beta-26?
> >
> > --
> > Ilya Obshadko
>
>


--
Ilya Obshadko
Reply | Threaded
Open this post in threaded view
|

Re: [5.4-beta-22] field-bound form validation messages

Ilya Obshadko-2
And I can confirm that in case of any validation error form values inside
AjaxFormLoop are completely messed up (text fields are cleared, checkboxes
are checked etc etc).

This is actually very major :(

On Sat, Mar 14, 2015 at 1:39 PM, Ilya Obshadko <[hidden email]>
wrote:

> Yes, this is it. Any options besides reverting to beta-6 (which is highly
> undesirable)?
>
> On Sat, Mar 14, 2015 at 5:10 AM, Geoff Callender <
> [hidden email]> wrote:
>
>> I think you're seeing this bug: "Field-specific error not shown when AJAX
>> used". It's been partially fixed in 5.4-beta-26, but there's still an issue.
>>
>>         https://issues.apache.org/jira/browse/TAP5-2391
>>
>> Geoff
>>
>> On 13 Mar 2015, at 1:41 am, Ilya Obshadko <[hidden email]>
>> wrote:
>>
>> > I've found out that at some point (not sure, but probably after upgrade
>> to
>> > 5.4-beta-22), custom form validation errors stopped displaying on
>> related
>> > fields. Effectively this breaks proper display of validation errors in
>> any
>> > form not using <t:errors/> component.
>> >
>> > I'm wondering if this is already fixed in 5.4-beta-26?
>> >
>> > --
>> > Ilya Obshadko
>>
>>
>
>
> --
> Ilya Obshadko
>
>


--
Ilya Obshadko
Reply | Threaded
Open this post in threaded view
|

Problem with Date data type ConstraintValidator in Tapestry 5.4 beta 28

cerfo
This post was updated on .
In reply to this post by Ilya Obshadko-2
Hello,
I'm using Tapestry 5.4 beta 28.
The problem is not solved yet.
I put my very simplified class.

I have an entity with two Date fields:

@Entity
@Table(name = "testparent", schema = "phoenix")
public class TestParent implements Serializable
{
     @Property
     @ValidateDb (name="V1")
     @Column(name = "F7dateReq")
     public Date f7datereq;

     @Property
     @ValidateDb (name="V2")
     @Column(name = "F14datetimeReq")
     public Date f14datetimeReq;
}

and a custom ValidateDb ConstraintValidator that ensure that date values are mandatory:

@Constraint(validatedBy = ValidateDbValidator.class)
@Target({ METHOD, FIELD, ANNOTATION_TYPE})
@Retention(RUNTIME)
@Documented
public @interface ValidateDb
{
    String message() default "{com.acme.constraint.Range.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String name() default "";
}


public class ValidateDbValidator implements ConstraintValidator<ValidateDb, Object> 
{
    @Override
    public void initialize(ValidateDb constraintAnnotation) {
    }

    public boolean isValid(Object value, ConstraintValidatorContext context)
    {

         String errorMessage=null;
         if (value==null)
             errorMessage="{validateDb.constraint.notNull}";

         context.disableDefaultConstraintViolation();
         if (errorMessage==null || "".equals(errorMessage.trim()))
        {
             context.buildConstraintViolationWithTemplate("").addConstraintViolation();
             return true;
        }
        else
       {
            context.buildConstraintViolationWithTemplate(errorMessage).addConstraintViolation();
            return false;
        }
    }
}


I'm using the standard bean edit form and when I press the "Save" button, I get just one message referring the wrong input component while I should get two distinct error messages, one for each field:

If I use two String fields instead of date fields, the messages are right:
Reply | Threaded
Open this post in threaded view
|

Re: Problem with Date data type ConstraintValidator

Thiago H de Paula Figueiredo
On Thu, 19 Mar 2015 04:08:05 -0300, Andrea Cerfogli <[hidden email]> wrote:


Hello,

Hi!

I'm using Tapestry 5.4 beta 27 on java 1.7.0_76 with Windows 8.1.
I'm not sure this is the right place where describe a potential bug.

I believe this should have been posted to the users mailing list first.

I put my very simplified class.

I have an entity with two Date fields:
@Entity

@Table(name = "testparent", schema = "phoenix")

public class TestParent implements Serializable{

@Property
@ValidateDb (name="V1")
@Column(name = "F7dateReq")
public Date f7datereq;

@Property
@ValidateDb (name="V2")
@Column(name = "F14datetimeReq")
public Date f14datetimeReq;
}

and a custom ValidateDb ConstraintValidator that ensure that date values are mandatory:


@Constraint(validatedBy = ValidateDbValidator.class)
@Target({ METHOD, FIELD, ANNOTATION_TYPE})
@Retention(RUNTIME)
@Documented
public @interface ValidateDb {
    String message() default "{com.acme.constraint.Range.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String name() default "";
}


public class ValidateDbValidator implements ConstraintValidator<ValidateDb, Object> {
 @Override
    public void initialize(ValidateDb constraintAnnotation) {
    }

    public boolean isValid(Object value, ConstraintValidatorContext context) {
     
     String errorMessage=null;     
     if (value==null)
      errorMessage="{validateDb.constraint.notNull}";

     context.disableDefaultConstraintViolation();     
     if (errorMessage==null || "".equals(errorMessage.trim()))
     {
      context.buildConstraintViolationWithTemplate("").addConstraintViolation();
      return true;      
     }
     else
     {
      context.buildConstraintViolationWithTemplate(errorMessage).addConstraintViolation();
      return false;
     }
    }
}


I'm using the standard bean edit form and when I press the "Save" button, the alert message appears in this way
In other words I get just one message referring the wrong input component while I should get two distinct error messages, one for each field.

If I use two String fields instead of date fields, the messages are right





--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br