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

Problem with 2 server validation behaviours on one page - need two different triggers but it's not validating the second instance

Thread began 11/22/2018 1:07 pm by Nathon Jones Web Design | Last modified 11/22/2018 7:14 pm by Nathon Jones Web Design | 41 views | 9 replies

Nathon Jones Web Design

Problem with 2 server validation behaviours on one page - need two different triggers but it's not validating the second instance

I have two Server Validations on one page as follows:

<?php 
if (isset($_POST["btnADDSTEP1"]) || isset($_POST["btnADDSTEP1_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_healthscreeningform_984_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateAN(((isset($_POST["FirstName"]))?$_POST["FirstName"]:"") . "",true,true,false,true,"-",true,1);
$WAFV_Errors .= WAValidateAN(((isset($_POST["Surname"]))?$_POST["Surname"]:"") . "",true,true,false,true,"-",true,2);
$WAFV_Errors .= WAValidateAN(((isset($_POST["Address"]))?$_POST["Address"]:"") . "",true,true,true,true,"-",true,3);
$WAFV_Errors .= WAValidateAN(((isset($_POST["Address2"]))?$_POST["Address2"]:"") . "",true,true,true,true,"-",false,4);
$WAFV_Errors .= WAValidateAN(((isset($_POST["City"]))?$_POST["City"]:"") . "",true,true,false,true,"-",true,5);
$WAFV_Errors .= WAValidateNM(((isset($_POST["Country"]))?$_POST["Country"]:"") . "",202,450,0,",.",true,6);
$WAFV_Errors .= WAValidateAN(((isset($_POST["Postcode"]))?$_POST["Postcode"]:"") . "",true,true,true,true,"",true,8);
$WAFV_Errors .= WAValidateAN(((isset($_POST["Telephone"]))?$_POST["Telephone"]:"") . "",false,false,true,true,"-()#+",false,9);
$WAFV_Errors .= WAValidateAN(((isset($_POST["Mobile"]))?$_POST["Mobile"]:"") . "",false,false,true,true,"-()#+",false,10);
$WAFV_Errors .= WAValidateEM(((isset($_POST["Email"]))?$_POST["Email"]:"") . "",true,11);
$WAFV_Errors .= WAValidateLE(((isset($_POST["EmailConfirm"]))?$_POST["EmailConfirm"]:"") . "",((isset($_POST["Email"]))?$_POST["Email"]:"") . "",true,12);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"healthscreeningform_984");
}
}
?>
<?php
if (isset($_POST["btnADDSTEP2"]) || isset($_POST["btnADDSTEP2_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_healthscreeningform_783_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateAN(((isset($_POST["GPName"]))?$_POST["GPName"]:"") . "",true,true,false,true,"-'().",true,7);

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



I won't add all of my form details but it's set up as follows...

<form name="formSTEP1" method="POST" action="">
<input type="text" class="form-control<?php
if (ValidatedField('healthscreeningform_984','healthscreeningform_984')) {
if ((strpos((",".ValidatedField("healthscreeningform_984","healthscreeningform_984").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?> is-invalid<?php //WAFV_Conditional health-screening-form.php healthscreeningform_984(1:)
}
}
}?>" name="FirstName" id="FirstName" placeholder="First name" maxlength="30" value="<?php echo(ValidatedField("healthscreeningform_984","FirstName")) ?>" required>
<?php
if (ValidatedField('healthscreeningform_984','healthscreeningform_984')) {
if ((strpos((",".ValidatedField("healthscreeningform_984","healthscreeningform_984").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<small class="text-danger">Invalid number or character.</small>
<?php //WAFV_Conditional health-screening-form.php healthscreeningform_984(1:)
}
}
}?>
<button type="submit" class="btn btn-info" name="btnADDSTEP1">Next <i class="fal fa-chevron-double-right"></i></button>
</form>

<form name="formSTEP2" method="POST" action="">
<input type="text" class="form-control<?php
if (ValidatedField('healthscreeningform_783','healthscreeningform_783')) {
if ((strpos((",".ValidatedField("healthscreeningform_783","healthscreeningform_783").","), "," . "7" . ",") !== false || "7" == "")) {
if (!(false)) {
?> is-invalid<?php //WAFV_Conditional health-screening-form.php healthscreeningform_783(7:)
}
}
}?>" name="GPName" id="GPName" placeholder="Your GP's Name" maxlength="100" required>
<?php
if (ValidatedField('healthscreeningform_783','healthscreeningform_783')) {
if ((strpos((",".ValidatedField("healthscreeningform_783","healthscreeningform_783").","), "," . "7" . ",") !== false || "7" == "")) {
if (!(false)) {
?><small class="text-danger">Please enter your GP's name.</small><?php //WAFV_Conditional health-screening-form.php healthscreeningform_783(7:)
}
}
}?>
<button type="submit" class="btn btn-info" name="btnADDSTEP2">Next <i class="fal fa-chevron-double-right"></i></button>
</form>



It's not validating the second instance of the behaviour (healthscreeningform_783).
Any idea what might be causing this?

Page attached for reference. Thank you.

Thank you.
NJ

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