PDA

View Full Version : Customize the Validation PHP code and adding to my own form?


carlene
10-26-2009, 12:56 PM
Hello!
I've followed the instructions for adding the Captcha to my own form and it's working just fine. I'd like to add the PHP Validation to my own form as well, but am a little confused as to what to do here.
For Example:
With this code from lines 82 -94 of sample_contactus.php :
<input name="seconddblock" id="seconddblock" type="text" style="display:none" value="" />
<?php
if (ValidatedField("contact","contact")) {
if ((strpos((",".ValidatedField("contact","contact").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
<span id="emailServerError" class="textfieldServerError">Please provide your email addess so we can get back in touch with you.</span>
<?php //WAFV_Conditional contact.php contact(2:)
}
}
}?>

Is "seconddblock" defined in the CSS SpryValidationTextField.css or the SpryValidationTextarea.css? Does this have to be form specific and need to be in there? I'm using my own form formatting. Also what does "contact" refer to? (That isn't the id of the sample_contactus.php form.) And what does php //WAFV_Conditional contact.php contact(2:) refer to?

Just trying to reverse engineer this PHP code and I guess I need it a little more spelled out.

I'm also wondering if there is more explanation for customization or for the PHP code in any of the documentation? Am I missing something?

Thanks!

Carlene

Jason Byrnes
10-26-2009, 02:22 PM
addblock is not used by the spry validation.

it is a validation technique called HoneyPots.

it is a hidden form element that is validated to be empty.

The idea is that a robot hijacking your form will assume that all form elements need to be filled out and submit the form with a value added to the addblock form element causing validation to fail.

It only has to be there if the Server Side validation include the regular expression validation for the addblock field.


This:
//WAFV_Conditional contact.php contact(2:)

Is a comment. it means that the validation show if region is for validatin #2 from the contact.php page.

instead of trying to reverse engineer the code, you could just use the Server Validation functions of the CSS form builder tool.

carlene
10-26-2009, 03:04 PM
Oh sorry, I don't have the CSS Form Builder tool. I have the Contact Form Solution pack! Just trying to work within this solution and make it work on my form.

So - I either have to just use the entire form provided in the solution pack - or nothing? There's no further documentation on customizing the Validation available?

I have the Validation Toolkit extension but it adds way too much javascript to my page! Just trying to get my code to be a little leaner.

Jason Byrnes
10-26-2009, 03:28 PM
You can use the validation toolkit extension as well. CSS Form builder is version 2 of validation toolkit.

it will only add javascript to your page if you use client side validation. using server side validation will only add php code.

we do not support hand coding what the tool can already do.

carlene
10-26-2009, 04:22 PM
OH - I see. So do I have that available to download for free then if I purchased the Validation Toolkit? I'm confused about this...

Thanks!

Jason Byrnes
10-26-2009, 04:34 PM
Server Validation is part of validation toolkit.