close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Server Validation Help Please

Thread began 3/23/2012 9:33 am by dan361748 | Last modified 3/29/2012 1:30 pm by Jason Byrnes | 786 views | 5 replies |

dan361748

Server Validation Help Please

Hi - I'm struggling a little with my server validation on my form. It just won't seem to fail.

Basically, if my form field userid (checkbox) is empty, I want the validation to fail. The field is in a repeat region and is set up as an array.

I have tried:

<?php
if (isset($_POST["massupdatego"])) {
$WAFV_Redirect = "admin_Users_Results_Email.php?massemail=no";
$_SESSION['WAVT_adminUsersResultsEmail_146_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["userid"]))?$_POST["userid"]:"") . "",true,1);

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

and I've also tried:

<?php
if (isset($_POST["massupdatego"])) {
$WAFV_Redirect = "admin_Users_Results_Email.php?massemail=no";
$_SESSION['WAVT_adminUsersResultsEmail_146_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["userid[]"]))?$_POST["userid[]"]:"") . "",true,1);

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

But it never fails if I don't check any selections.

Any help would be really appreciated!
Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your page please so i can examine the code in context.

Sign in to reply to this post

dan361748

Thanks - attached is the file.

Sign in to reply to this post

Jason ByrnesWebAssist

rule #1 when working with forms:
The Form data can only be processed on the forms action page.


the page you have sent is named "admin_Users_Results_Email.php". the action of the form with the userid checkbox is to post to a different page named "admin_Users_Mass_Email.php":

php:
<form  action="admin_Users_Mass_Email.php" method="post" id="usermassemail" name="usermassemail">



when the form is submitted, the action page is loaded to receive the form data. you can only validate the form data on that page.

you will either need to move the validation code to the "admin_Users_Mass_Email.php" page, or change the action of the form to post to the "admin_Users_Results_Email.php" page instead.

Sign in to reply to this post

dan361748

Thanks Jason - thought it was something silly like that.

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

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...