Hello,

 

I cannot seem to get a textfield validate message to work using regexp and
message catalogs.

 

I use Tomcat/Eclipse.

 

This is my .tml:

<td><b>Cell Phone:</b></td>

<td><t:textfield id="cellPhone" value="cellPhone"/></td> 

 

This is my java:

@Validate("regexp")

public String getCellPhone(){

return getVisit().getNstuMember().getCellphone();

}

public void setCellPhone(String cellPhone){
getVisit().getNstuMember().setCellphone(cellPhone);

}

 

This is my message catalogue:

cellPhone-regexp=\d{3}-\d{2}-\d{4}

cellPhone-regexp-message=Invalid Number EX: (555) 555-5555,5555555555

 

I have tried placing it(Main.properties) everywhere and tapestry always
throws this error:

Render queue error in BeginRender[Main:textfield_7]: Failure reading
parameter 'validate' of component Main:textfield_7: Validator 'regexp'
requires a validation constraint (of type java.util.regex.Pattern) but none
was provided. The constraint may be provided inside the @Validator annotaton
on the property, or in the associated component message catalogue as key
'personalForm-textfield_7-regexp' or key 'textfield_7-regexp'. 

 

In the docs it says to use this format:

<t:textfield t:id="ssn" validate="required,regexp"/>

And your message catalogue can contain:

 

ssn-regexp=\d{3}-\d{2}-\d{4}

ssn-regexp-message=Social security numbers are in the format 12-34-5678.

 

What am I missing?

 

Thanks,

--James

 

 

Reply via email to