You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by taj uddin <ta...@yahoo.com> on 2009/11/26 08:46:41 UTC

Error Messges(Field Validator Type = regex)

Hi Friends, 
        I am using struts 2.1.6. Facing problem with error messages. 
 When i use 'regex' validator in validation.xml file than 
 1. when i clicked on submit button for the first time. 
       It is showing error messages like 
                 Customer name is required. 
                 Allow alphabets only. 
 the above message 'Allow alphabets only must show when some invalid data enter in the field other than alphabets. 
2. with out entering data again i clicked submit button. 
than know error messages are 
  Customer name is required. 
  Allow alphabets only. 
  Customer name is required. 
  Allow alphabets only.       Repated twice. 
if i clicked again thrice......... 
And my code in xml file is, and using default theme 

<field name="customer.name">     
    <field-validator type="requiredstring" short-circuit="true"> 
      true
      <message key="error.cusname.req"></message> 
    </field-validator> 
    <field-validator type="regex" > 
            <![CDATA[(^[a-zA-Z ]+$)]]>
        <message key="error.cusname.fv"></message> 
    </field-validator> 
   </field> 
 if i remove regex than it is working fine. 
Could u tell me how to reolve this issue. 
 
Thanks,
Taj