Hey everyone,
I am working on a new site and using chronoforms 3.1 RC5.1 for a contact form. I am having two issues with the live validation that I cannot seem to solve. I am using the exact same validation method as I did on a previous site, but it that site was using Chrono Forms 3.1 RC4.11, so I am not sure if the validation methods have changed or if something else is up, but I am getting very inconsistent results.
I am trying to validate a phone number field using:
window.addEvent('domready', function() {
var phoneVal = new LiveValidation( "phoneVal", {validMessage: " ", onlyOnBlur: true } );
phoneVal.add(Validate.Format, { pattern: /^[2-9]\d{2}\-\d{3}\-\d{4}$|\({1}[2-9]\d{2}\){1}\s?\d{3}\-\d{4}|[2-9]\d{2}\s\d{3}\s\d{4}$/, failureMessage: "Please enter a valid phone number xxx-xxx-xxxx or (xxx)xxx-xxxx" });
});
in my html I have:
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Phone Number:</label>
<input class="cf_inputbox required" maxlength="150" size="30" title="phoneNumber" id="phoneVal" name="phone" type="text" />
</div>
<div class="cfclear"> </div>
</div>
The problem is, when I am typing a number into the field, it right away gives me the error message (Please enter a valid phone number). However if I move the cursor to another field, the phone number field now goes green as if itis correct. If I put the cursor back to the phone number field, it shows the error message again.
If I leave it as is and hit submit, then the error message pops back up. I need the error message to stay on the field until the correct data is entered in.
As another update, the validation for this field is now not working. Without making any changes at all to my site other than reloading the page, it has stopped validating this phone number field. Very inconsistent!
The other problem I am having is that I cannot seem to alter the validation output. I am changing items in the consolidated_common.css but this is having no effect on the validation messages. I tried renaming the .css file and this works to at least remove colours, etc. but the generic messages keep popping up (This field is required).
I saw another post saying to comment out the mootools.js line in index.php, but I cannot find this line in that file. However viewing my source I see that:
<script type="text/javascript" src="/media/system/js/mootools.js"></script>
is being loaded, but I cannot find where to comment this out!
I don't know. Maybe I am just tired today but I can't seem to get this working properly. Can anyone give me a hand with this?
Thanks,
Kelly
I am working on a new site and using chronoforms 3.1 RC5.1 for a contact form. I am having two issues with the live validation that I cannot seem to solve. I am using the exact same validation method as I did on a previous site, but it that site was using Chrono Forms 3.1 RC4.11, so I am not sure if the validation methods have changed or if something else is up, but I am getting very inconsistent results.
I am trying to validate a phone number field using:
window.addEvent('domready', function() {
var phoneVal = new LiveValidation( "phoneVal", {validMessage: " ", onlyOnBlur: true } );
phoneVal.add(Validate.Format, { pattern: /^[2-9]\d{2}\-\d{3}\-\d{4}$|\({1}[2-9]\d{2}\){1}\s?\d{3}\-\d{4}|[2-9]\d{2}\s\d{3}\s\d{4}$/, failureMessage: "Please enter a valid phone number xxx-xxx-xxxx or (xxx)xxx-xxxx" });
});
in my html I have:
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Phone Number:</label>
<input class="cf_inputbox required" maxlength="150" size="30" title="phoneNumber" id="phoneVal" name="phone" type="text" />
</div>
<div class="cfclear"> </div>
</div>
The problem is, when I am typing a number into the field, it right away gives me the error message (Please enter a valid phone number). However if I move the cursor to another field, the phone number field now goes green as if itis correct. If I put the cursor back to the phone number field, it shows the error message again.
If I leave it as is and hit submit, then the error message pops back up. I need the error message to stay on the field until the correct data is entered in.
As another update, the validation for this field is now not working. Without making any changes at all to my site other than reloading the page, it has stopped validating this phone number field. Very inconsistent!
The other problem I am having is that I cannot seem to alter the validation output. I am changing items in the consolidated_common.css but this is having no effect on the validation messages. I tried renaming the .css file and this works to at least remove colours, etc. but the generic messages keep popping up (This field is required).
I saw another post saying to comment out the mootools.js line in index.php, but I cannot find this line in that file. However viewing my source I see that:
<script type="text/javascript" src="/media/system/js/mootools.js"></script>
is being loaded, but I cannot find where to comment this out!
I don't know. Maybe I am just tired today but I can't seem to get this working properly. Can anyone give me a hand with this?
Thanks,
Kelly
Hi Kelly,
#1- yes, it looks like a problem with RC5, it doesn't happen with my latest files here though so please wait for RC5.2 or contact me to get them!
#2- I think this may be a browser/website cache problem ?
Max
#1- yes, it looks like a problem with RC5, it doesn't happen with my latest files here though so please wait for RC5.2 or contact me to get them!
#2- I think this may be a browser/website cache problem ?
Max
This topic is locked and no more replies can be posted.