PDA

View Full Version : Validation Show If statement not displaying


Phil137
04-30-2009, 05:00 PM
I am working on a form with server side validation in php. The form validates the user’s change in profile and then displays one of several hidden tables depending on the fields that were completed. The information is posted to the same page. The problem I am having is when everything has been processed the validation Show If statement will not display a successfully completed message stored in a hidden table. The code below is what I am using; unfortunately, I am unable to get the hidden table to reveal itself after the page has been submitted.
<?php
if (ValidatedField("Profile","Profile")) {
if ((strpos((",".ValidatedField("Profile","Profile").","), "," . "") >= 0)) {
if (!((strpos((",".ValidatedField("Profile","Profile").","), "," . "1" . ",") !== false || "1" == "") || (strpos((",".ValidatedField("Profile","Profile").","), "," . "2" . ",") !== false || "2" == ""))) {
?>
<table width="265" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="265" align="left" bgcolor="#FFFFCC" class="red">(Password successfully changed)</td>
</tr>
</table>
<?php //WAFV_Conditional Profile.php Profile(:1,2)
}
}
}?>


Thanks in advance for any help.

Ray Borduin
05-01-2009, 06:29 AM
Don't use validation show if for this.

Just use:

<?php
if (isset($_POST)) {
?>
<table width="265" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="265" align="left" bgcolor="#FFFFCC" class="red">(Password successfully changed)</td>
</tr>
</table>
<?php
}
?>

Validation show if server behavior will never do anything when no validations fail at all. At that point validations are cleared and it is as if they never happened. The code above will work in that case instead.

Phil137
05-01-2009, 10:57 PM
Thank you for the help. I am not a programmer so it is probably something really simple that I am overlooking. I placed the new script in but now the table displays regardless of the form's success or failure.

My form id is as follows:

<form id="WAATKUpdateFormPS" name="WAATKUpdateFormPS" method="POST" action="<?php echo $editFormAction; ?>">

Do I need to incorporate any elements from the form to enable the code below to reveal itself only upon a successful submission?

<?php
if (isset($_POST)) {
?>
<table width="265" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="265" align="left" bgcolor="#FFFFCC" class="red">(Password successfully changed)</td>
</tr>
</table>
<?php
}
?>

Phil137
05-03-2009, 01:17 PM
Thanks again Ray for the help.
I got my form to function as it posted a notice of success or failure to the page it is on by incorporating AJAX along with PHP.