close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Validation If not displaying for Validation Pass

Thread begun 10/02/2019 12:06 pm by Nathon Jones Web Design | Last modified 10/09/2019 10:48 am by Ray Borduin | 917 views | 6 replies |

Nathon Jones Web Design

Validation If not displaying for Validation Pass

I've always used Validation Show If to display a message if validation fails.
I've tried setting up a page that displays a message if validation passes, however despite the validation passing, confirmed by the appended querystring on $WAFV_Redirect, the Validation Show If section is not displaying.

The server behaviour...

<?php 
if (isset($_POST["smcresetBTN"]) || isset($_POST["smcresetBTN_x"])) {
$WAFV_Redirect = "reset.php?ve=1";
$_SESSION['WAVT_reset_570_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateEM(((isset($_POST["SMCuserUSER"]))?$_POST["SMCuserUSER"]:"") . "",true,1);
$WAFV_Errors .= WAValidateUnique("csdbmysqli",$csdbmysqli,$database_csdbmysqli,"SMCuser","SMCuserID","none,none,NULL","0","SMCuserUSER","',none,''","".(((isset($_POST["SMCuserUSER"]))?$_POST["SMCuserUSER"]:"")) ."",true,2);

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



The form with the Validation Show If area...

<form action="" name="SMCresetpwFORM" method="post">
<div class="form-group">
<label for="SMCuserUSER" class="sr-only">E-mail address</label>
<input type="email" name="SMCuserUSER" id="SMCuserUSER" class="form-control" placeholder="Enter your e-mail address" value="<?php echo(ValidatedField("reset_570","SMCuserUSER")) ?>" required>

<?php
if (ValidatedField('reset_570','reset_570')) {
if ((strpos((",".ValidatedField("reset_570","reset_570").","), "," . "") >= 0)) {
if (!((strpos((",".ValidatedField("reset_570","reset_570").","), "," . "2" . ",") !== false || "2" == ""))) {
?>
<small class="text-danger">Are you sure you've entered the correct e-mail address?</small>
<?php //WAFV_Conditional reset.php reset_570(:2)
}
}
}?>
</div>
<button class="btn btn-info btn-block" type="submit" name="smcresetBTN" id="smcresetBTN"><i class="fal fa-key"></i> Reset Password</button>
</form>



Hope you can help. Thank you.
NJ

Sign in to reply to this post

Nathon Jones Web Design

OMG. I just can't cope with double negatives! :S

I am trying to validate if the entered e-mail address DOESN'T already feature in the users table. So, WAValidateUnique is the wrong validation to use because it's checking if the e-mail address DOES already feature in the users table. Right?

So can this even be handled with WA Server Validation?

Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Validate unique will make sure that the email address isn't repeated, so it will fail if the email address is already in the table. It sounds like that is what you want.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Actually no. I need to check if an email address doesn’t exist in the table.

Sign in to reply to this post

Ray BorduinWebAssist

Can you explain the use case? You want it to fail validation if the email address doesn't already exist? The way to do that is to create a recordset filtered by the submitted email address and then validate the number of rows in the recordset is greater than 0 using numeric validation. You just have to manually move the recordset above the validation code since it will be placed below by default.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

I need to check if an e-mail exists in the system so that, if it does, we can send a password reminder.
If it doesn't, I need to display an error message.

Effectively we'd need to set up a simple search form here, to query the database. If TotalRows are 0 then it's safe to assume that the e-mail address doesn't exist and we can display an error message accordingly etc.

I think I was just stuck in using, completely, the WA Server Validation behaviour for this and then a double negative happened and my brain popped.

Much appreciated.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

You should be able to add a recordset to the page filtered by the entered email address and then use validation to validate that the Total Rows returned is greater than zero.

Sign in to reply to this post
Did this help? Tips are appreciated...

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