close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Can't Get Form Fields to Validate

Thread began 8/04/2010 11:06 pm by info129501 | Last modified 8/05/2010 6:17 pm by Jason Byrnes | 1211 views | 11 replies |

info129501

Can't Get Form Fields to Validate

I'm using the PHP_StartingPoint files to learn how to apply server validations and can't seem to get the Validation Toolkit extension to validate the "name" field in the form as required.

1/ Form action is blank
2/ Failed Redirect is blank
3/ Validation Trigger: tried both Any Form Post and Submit Button Press
4/ Applied Validation Show If behavior
5/ Applied WA Validated Entries binding to maintain form data when validation fails

On page with the form, I left the "name" field blank and clicked the submit button to check validation:
==> page redisplayed
==> Validation Show If error message did not display next to "name" field as expected

Also tried all the above with another form that uses Universal Email and got the same result -- no obvious validation. Lastly, tried client validation and that didn't work either.

What am I doing wrong? How can I fix the problem, wherever it is? Would appreciated some direction or assistance. Thanks in advance.

CAVEAT: I'm not a coder, so if you have a solution, please be as explicit as possible. Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

can you please post back a copy of the page so I can take a look at the code.

Sign in to reply to this post

Jade

Post of Server Validation Page

Thanks so much for answering, particularly in light of the new fee-based support ticket system.

Here is the URL for the page I'm working with: Server_Validations.php

If "post back a copy of the page" you mean provide the source code, I tried sending, but too many characters, so below is the PHP that appears before the DOCTYPE and the code for the form up to the "name" field to be validated.

========================

<?php require_once("../WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("../WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "";
$_SESSION['WAVT_ServerValidations_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Name"]))?$_POST["Name"]:"") . "",true,1);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"ServerValidations");
}
}
?>

===================================

<form action="" method="POST" name="EditUser">
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="25">&nbsp;</td>
<td colspan="3" class="validationErrors">&nbsp;</td>
</tr>
<tr>
<td width="25">&nbsp;</td>
<td colspan="3" class="subHeader">Sign-up</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="formTitle"><div align="right">Name:</div></td>
<td width="280" class="formField"><input name="Name" type="text" id="Name5" value="<?php echo(ValidatedField("ServerValidations","Name")) ?>" size="40"></td>
<td width="225" class="validationErrors"><?php
if (ValidatedField('ServerValidations','ServerValidations')) {
if ((strpos((",".ValidatedField("ServerValidations","ServerValidations").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
Required
<?php //WAFV_Conditional Server_Validations.php ServerValidations(1:)
}
}
}?>

Sign in to reply to this post

Jason ByrnesWebAssist

can you add the php page to a zip archive and attach the zp file to your reply so i can see the entire page code.

Sign in to reply to this post

Jade

PHP files uploaded as ZIP file. Thanks so much! I'm hopeful you'll be able to help me out.

Attached Files
Server_Validations.zip
Sign in to reply to this post

Jason ByrnesWebAssist

curious, your page validates properly when I test it on my computer.

first thing I'd like to test is that the page online has the validation applied to it. It may be that you uploaded this file, applied server validation then uploaded it again, sometimes Dreamweaver will fail on the upload, but report success.

To test this, add today's date to the page within the body, or some other visible change to the page, then upload it again. If you don't see today's date when you view the page, then the upload is failing for some reason, try deleting the file from the server, then uploading again.

If you do see today's date on the page something else is wrong.

Try adding the following code at line 1, there may be a php error occurring:

php:
<?php

error_reporting
(E_ALL);
ini_set('display_errors','on');
?>



also, find the following code:

php:
if ($WAFV_Errors != "")  {

    PostResult($WAFV_Redirect,$WAFV_Errors,"ServerValidations");
  }


and change it to:

php:
var_dump($_POST);

echo("<br />");
if ($WAFV_Errors != "")  {
   die($WAFV_Errors);
    PostResult($WAFV_Redirect,$WAFV_Errors,"ServerValidations");
  }





this will help me troubleshoot further.

Sign in to reply to this post

Jade

Did as you suggested and got error msgs at top of page -- included in attached ZIP file.

How do did you test the page and get the proper results? What I've been doing is going to the page online and clicking the submit button WITHOUT putting anything in the "name" field. It should return the error and display the "Required" msg next to that field, right?

Thanks for helping!

Attached Files
top of page error msg.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the error you are getting is caused by a bad session.save_path value in your php.ini file.

you will need to contact your host to have this resolved, the validation errors are stored in a session, since the session cannot be started, the validation will not work.

contact the host to have them correct the issue with the session.save_path setting.

Sign in to reply to this post

Jade

I will definitely contact my host to attempt a resolve on their end. Should I need further info from you on this for them, can I still post here for your help?

Thank so much for everything.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, you will still be able to update this thread until it is resolved.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...