Phone number Validation in chronoforms

krishna.mondeddu 18 Jun, 2013
Hiiii...........Guyzzz

I have a problem with chronoforms Joomla 2.5 .. i installed this component and i created form by using this one... In that i have a phone number field also .. in validation i gave like required and phone number.. but it is working as number.. means phone number means commonly it should have 10 digits ... but in this case for one number also it is getting true... so how can we solve this problem...........pls help me urgent ...
GreyHead 18 Jun, 2013
Hi krishna.mondeddu,

Phone numbers change quite a lot from country to country. The FormCheck validation in ChronoForms uses this Regular expression to test them: /^\+{0,1}[0-9 \(\)\.\-]+$/. As you say this will accept any number of digits.

You can add a custom validation to be more precise. Please see this FAQ

Bob
krishna.mondeddu 18 Jun, 2013
Thanks for your reply.... but here i am adding my code like
function customCheck(el){
  if ( !el.value.test("/^\+{0,1}[0-9 \(\)\.\-]+$/") ) {
    el.errors.push("Add an error message here");
      return false;
  } else {
    return true;
  }
}

add i added validate['required','%customCheck'] in class field in phone field.... if i click on submit.. it is not validating and it is showing thank u msg .....
krishna.mondeddu 18 Jun, 2013
K boss thank uuuu.......... Finally i got it. thank u very muchhhhhhhhhhhhhhh
GreyHead 18 Jun, 2013
Hi krishna.mondeddu,

Well done.

Bob
Mradula Pai 06 Mar, 2014

K boss thank uuuu.......... Finally i got it. thank u very muchhhhhhhhhhhhhhh



Please give the solution for the problem you faced.. Even i am facing the same problem......
This topic is locked and no more replies can be posted.