chadhini wrote on Friday, October 09, 2015:
Hi
I have been trying to use the registration form with proper validation and as I go I find that some of the validation like - mobile number length and input characters are not getting validated by the provided javascript function - checkPhone() and checkLength(). Can someone look into this and clear the doubt.
I tried changing the input tag for mobile number with attribute minlength , to limit the input to 10 digits but no success.
if ($field_id_esc=='phone_cell')
{
echo "<input type='text'" .
" name='form_$field_id_esc'" .
" id='form_$field_id_esc' minlength=10" .
" size='$fldlength' $string_maxlength" .
" required " .
" title='$description'" .
" value='$currescaped'";
}
and the js function -
function validate(f) {
var errMsgs = new Array();
<?php generate_layout_validation('DEM'); ?>
<?php if($GLOBALS['erx_enable']){ ?>
alertMsg='';
for(i=0;i<f.length;i++){
if(f[i].type=='text' && f[i].value)
{
if(f[i].name == 'form_fname' || f[i].name == 'form_mname' || f[i].name == 'form_lname')
{
alertMsg += checkLength(f[i].name,f[i].value,35);
alertMsg += checkUsername(f[i].name,f[i].value);
}
else if(f[i].name == 'form_street' || f[i].name == 'form_city')
{
alertMsg += checkLength(f[i].name,f[i].value,35);
alertMsg += checkAlphaNumericExtended(f[i].name,f[i].value);
}
else if(f[i].name == 'form_phone_cell')
{
alertMsg += checkPhone(f[i].name,f[i].value);
//alertMsg += checkLength(f[i].name,f[i].value,10); // for checking the length
}
}
}