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