CF Form Validation Not Working

JoeKMT 10 Feb, 2009
Hello,
I can't seem to figure out why the form validation is not working, here is what I'm getting with debug.

_POST: Array ( [nature] => Please provide my local dealer's info [fname] => Joe [lname] => Militello [email] => [company] => [address1] => [address2] => [city] => Kalispell [state] => MT [zip] => 59901 [phone] => [model] => Savoy [comments] => Testing 4 [find] => dealer [547063e8ddc4eaae4ee9c42e984108fa] => 1 )
E-mail message

From: []
To: [email]joem@406graphics.com[/email]
Subject: Contact Us Form Results
Please provide my local dealer's info First Name: Joe {fname_required} Last Name: Militello {lname_required} Email: {email_required} Company: Address 1: Address 2: City: Kalispell {city_required} State: MT {state_required} Zip: 59901 {zip_required} Phone: Model most interested in?: Savoy Comments: Testing 4 How did you find us?: dealer Submitted by 69.146.22.181

Would you please comment on this, I can't seem to find any documentation that covers this.

Thanks,

Joe
GreyHead 10 Feb, 2009
Hi JoeKMT,

Usually Validation problems are JavaScript conflicts . . . can't tell anything about these from the DeBug code unfortunately. Is the form on-line?

Bob
GreyHead 10 Feb, 2009
Hi Joe,

You have both the JQuery and MooTools libraries installed on the contact form page. I think that's the root of the problem. If you load the form without the template then the validation works fine.

MooTools is standard for Joomla 1.5 installations anything that uses JQuery is increasingly likely to cause you problems like this.

Bob

PS See the form without the template here
JoeKMT 10 Feb, 2009
Thanks, so this is a problem then, I don't want to use mootools on this site, any suggestions?
GreyHead 10 Feb, 2009
Hi Joe,

Well the only one I have is to find some JQuery validation library and use that or some validation library that is compatible. Not helpful . . . sorry

Bob
JoeKMT 10 Feb, 2009
Thanks Bob, what about server side PHP, I've been looking in the forum and online for validation code but I'm not real clear on how to execute it because most of the examples I've seen include the entire page code HTML included. I know my lack of experience is not your fault and I do want to say thank you for your fast response to my post, I have become very frustrated with a lot of Joomla extensions and their lack of support and documentation and while it would be nice if in the future CF had more detailed documentation and tutorials for those of us who aren't as gifted in understanding code, hey that's why I use Joomla in the first place, you do a much better job then most in the area of support. Don't get me started on RSForms, they should be banned from doing business with Joomla.
Any way, got off track there, any extra help with PHP validation would be greatly appreciated.

Thanks again for all of your help,

Joe 😀
GreyHead 10 Feb, 2009
Hi Joe,

You can validate anything server-side in PHP - it's just that the form has to be submitted first and it's not so user friendly. Here's a quick - off the top of my head version:
<?php
$post = JRequest::get('post');
$messages = array();
if ( $post['lname'] == '' ) {
    $messages[] = "You must enter a first name";
}
if ( $post['lname'] == '' ) {
    $messages[] = "You must enter a last name";
}
. . . 
if ( count($messages) > 0 {
    return explode('<br />', $messages);
}
?>
You could add more complicated code to check email addresses, numbers etc. but the principal here should work OK.

Bob
JoeKMT 10 Feb, 2009
Ok Bob, I uninstalled CF and re-installed it, only this time I didn't turn on Chronocontact and it works. Was I not to turn that on to begin with?

Joe
This topic is locked and no more replies can be posted.