I think it may be helpful to have a validation option that allows spaces to be input in alpha values or integer values. Many Names and Numbers needs either spaces or phone numbers need - or () and spaces.
Just a thought. Love the extension works great.
Cliff
Just a thought. Love the extension works great.
Cliff
Hi Cliff,
See the hack here for a US phone number. I imagine that it would be fairly simple to extend or adopt his to other formats.
You can easily amend the RegEx code in the standard validation code to add an extra group of characters.
Bob
Bob
See the hack here for a US phone number. I imagine that it would be fairly simple to extend or adopt his to other formats.
You can easily amend the RegEx code in the standard validation code to add an extra group of characters.
Bob
Bob
yeah i'll do that. Thanks, i just thought it would be useful for a future release for the straight install users.
:) again chrono forms is a great tool thanks
:) again chrono forms is a great tool thanks
I realize I'm jumping on a two year old thread, but this followup is directly relevant to it.
I'm working with CF 3.1 RC 5.5.
To add this US phone number validation, I believe I need to change three files:
1. administrator/components/com_chronocontact/admin.chronocontact.html.php
Vicinity of line 2300, I need to create a new row on the validation tab for val_validate_phone
2. components/com_chronocontact/js/mooValidation.js
Vicinity of line 200, I need to add the validation regex referenced in the link above
3. administrator/components/com_chronocontact/admin.chronocontact.php
Vicinity of line 1975, I need to add $params[] = "val_validate_phone=";
Am I missing any other files or changes?
Thanks, and once I've completed this, I'll post a reply with the exact changes made.
I'm working with CF 3.1 RC 5.5.
To add this US phone number validation, I believe I need to change three files:
1. administrator/components/com_chronocontact/admin.chronocontact.html.php
Vicinity of line 2300, I need to create a new row on the validation tab for val_validate_phone
2. components/com_chronocontact/js/mooValidation.js
Vicinity of line 200, I need to add the validation regex referenced in the link above
3. administrator/components/com_chronocontact/admin.chronocontact.php
Vicinity of line 1975, I need to add $params[] = "val_validate_phone=";
Am I missing any other files or changes?
Thanks, and once I've completed this, I'll post a reply with the exact changes made.
Hi cohncons,
The validation method that ChronoForms uses has changed in the meantime. It now uses LiveValidation and the mooValidation.php file isn't in use.
The best way to do this is to use a custom validation like this in the Form JavaScript box
Bob
The validation method that ChronoForms uses has changed in the meantime. It now uses LiveValidation and the mooValidation.php file isn't in use.
The best way to do this is to use a custom validation like this in the Form JavaScript box
window.addEvent('load', function() {
var phone_val = new LiveValidation('phone', {
validMessage: 'Perfect, well done!',
onlyOnSubmit: true
});
phone_val.add(
Validate.Format, {
pattern: /\(?\b[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\b/i,
failureMessage: 'Oops! THat's not a valid phone number.'
});
});
You may need to change the regexp and 'phone' needs to match the id of the input you are validating.Bob
Thanks.. Was looking for that regex code for US number..ao lot nam, quan lot nam, do boi tre em, do ngu, do ngu nu, rbi, narsis, do so sinh, do so sinh cho be, quan ao so sinh, ban buon quan ao, thoi trang cong so, ban buon quan ao, do lot[/url]
Quick Question about the regexp,
Im thinking about splitting the landline and mobile numbers up as often I would prefer a landline over a mobile. Unlike US phone numbers we simply enter them all in one go but the first 2 numbers are always either 01, 02 or 03.
Likewise mobile phone numbers over here are always 07, so how to achieve this I wonder?
Regards,
Tom.
Im thinking about splitting the landline and mobile numbers up as often I would prefer a landline over a mobile. Unlike US phone numbers we simply enter them all in one go but the first 2 numbers are always either 01, 02 or 03.
Likewise mobile phone numbers over here are always 07, so how to achieve this I wonder?
Regards,
Tom.
Hi Cliff,
See the hack here for a US phone number. I imagine that it would be fairly simple to extend or adopt his to other formats.
You can easily amend the RegEx code in the standard validation code to add an extra group of characters.
Bob...
As you know, I'm new to CF. I'm a bit confused about the implementation of this hack. Do I need to put the field name(s) in the code? I'm assuming this would go in the server-side validation field - am I correct?
Hi gpseymour,
Bob
You may need to change the regexp and 'phone' needs to match the id of the input you are validating.
Bob
Hi cohncons,
The validation method that ChronoForms uses has changed in the meantime. It now uses LiveValidation and the mooValidation.php file isn't in use.
The best way to do this is to use a custom validation like this in the Form JavaScript box
window.addEvent('load', function() {
var phone_val = new LiveValidation('phone', {
validMessage: 'Perfect, well done!',
onlyOnSubmit: true
});
phone_val.add(
Validate.Format, {
pattern: /\(?\b[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\b/i,
failureMessage: 'Oops! THat's not a valid phone number.'
});
});
You may need to change the regexp and 'phone' needs to match the id of the input you are validating.Bob
Not having success with this - what am I missing? [Validation is enabled]
Thank you!
Rainie dey
Hi Rainie,
The input id needs to be just phone id="phone" name="phone" (the _val bit is only used in the JavaScript).
Bob
The input id needs to be just phone id="phone" name="phone" (the _val bit is only used in the JavaScript).
Bob
Hi Rainie,
Please post a link to the form so that we can take a quick look.
Bob
Please post a link to the form so that we can take a quick look.
Bob
Hi Rainie dey,
There's an unescaped quote in my Failure Message that will cause a problem
You also have MooTools 1.2 loading on the page and that might cause problems but fix the quote first and see.
Bob
There's an unescaped quote in my Failure Message that will cause a problem
window.addEvent('load', function() {
var phone_val = new LiveValidation('phone', {
validMessage: 'Perfect, well done!',
onlyOnSubmit: true
});
phone_val.add(
Validate.Format, {
pattern: /\(?\b[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\b/i,
failureMessage: 'Oops! That is not a valid phone number.'
});
});
You also have MooTools 1.2 loading on the page and that might cause problems but fix the quote first and see.
Bob
This topic is locked and no more replies can be posted.