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

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 Ray Borduin | 136 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

Sign in to reply to this post

Ray BorduinWebAssist

Please describe what steps you go through and what happens as compared to what you expect would happen. The code is on the page, so you don't need to include that inline.

The information you gave me to go on is:
"It's not validating the second instance of the behaviour (healthscreeningform_783)".

You have two different forms on the page... are you expecting them to both submit at once? How are you expecting this to all work? You submit page 1 first? Then they click to go to page 2? I'm a bit confused. Do you have a url where I can view this. I need a better description of what you are trying to do here.

Sign in to reply to this post

Nathon Jones Web Design

Please find a link to the form below. I'm trying to set it up using Bootstrap 4 nav tabs so that what is actually a very long form is more digestible - it being split into 5 sections (Steps 1-5) using the Bootstrap tabs. However, the form is entirely on one page.

I'm running into problems because of the following...

1) When a user completes Step 1 (the first form on the first tab), I am saving to database because the client wants the user to automatically receive login details so that should they only part complete the form, they can later return to it (it being saved and available in a user/pass protected area).

2) Once a user progresses past Step 1, I would prevent them from submitting Step 1 again, in this session, based on whether or not there was an instance of a newID session (created in the MySQLi Insert behaviour).


3) So, Step 1 is validating (healthscreeningform_984) and submitting to database correctly. I have not implemented it yet, but I will be doing an insert to multiple tables at this stage - Customer, Order and Order Detail

4) At this stage it progresses you to Step 2 which I have only set up one validation on so far (GP's Name). It is this validation (healthscreeningform_783) that's not working.

As well as setting up validation on the forms within each Step I also need, at the end of each step, to run an UPDATE behaviour on the Order Detail table (basically the entire form data from Steps 2-5).

Hope that makes sense. If you feel there is an easier way to approach this, I'm all ears btw!

Thank you Ray.
NJ

PS. Are you back from sailing?

Sign in to reply to this post

Ray BorduinWebAssist

I'll need FTP access to debug this. I'm not quite sure what is going on.

I'm still in the Bahamas in the bay of an uninhabited island, but I have cell service so I can work a little.

Sign in to reply to this post

Nathon Jones Web Design

Thank you Ray. FTP details below, if you have the time. A bay of an uninhabited island in the Bahamas sounds like just what I need...permanently!

Sign in to reply to this post

Ray BorduinWebAssist

I can't seem to get in with that FTP information. Please verify that there are no typos and that there isn't any IP restrictions that would prevent my access.

Sign in to reply to this post

Nathon Jones Web Design

No typos. Just double checked it there. You're including the exclamation mark in the password, right?
No IP restrictions either.

Sign in to reply to this post

Ray BorduinWebAssist

I'm not sure why I can't get in then. I'm copying and pasting from your message, so it can't be a typo on my end.

I get this error in FileZilla:
Response: 425 Sorry, invalid address given

I'll need to access your files in order to debug this issue. Do I need any additional ftp settings I might be missing?

Sign in to reply to this post

Nathon Jones Web Design

Just cut and pasted the above FTP details into FileZilla and it's let me straight in.

Settings - no port specified. Encryption is 'Use explicit FTP over TLS if available'. Logon Type = Normal Server Type = Default (Autodetect)

Sign in to reply to this post

Ray BorduinWebAssist

I still can't connect. I wonder if it has something to do with my Bahamas IP address? I'm on vacation until December 6th.

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