Joomla 3.3.6 user profile form validation

50 Views Asked by At

I am trying to add validation to fields in user profile form.So I added

 <field
                    name="postal_code"
                    type="text"
                    id="postal_code"
                                    **class="validate-numeric"**
                    description="PLG_USER_PROFILE_FIELD_POSTAL_CODE_DESC"
                    filter="string"
                    label="PLG_USER_PROFILE_FIELD_POSTAL_CODE_LABEL"
                    size="30"                                
                            />

to plugins\user\profile\profiles\profile.xml.Its working fine with user registration.How can this be resolved?

1

There are 1 best solutions below

0
Richa On

Create a class JFormRulePostal_code extending JFormRule in libraries/joomla/form/rule/ and change type="postal_code" and class="postal_code.