close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Validation without requiring entry

Thread began 3/16/2017 3:39 pm by Justin@AdventDesign | Last modified 3/17/2017 1:30 pm by Ray Borduin | 65 views | 10 replies |

Justin@AdventDesign

Validation without requiring entry

I created a fresh new data bridge backend for a database table a few months back. The project has sat until now. I was doing some final testing and I'm having an issue with form validation. It would appear that all of my form fields that I'm using validation for are requiring an entry on the insert page. I want to validate things like phone numbers for proper format IF there is an entry, but I don't want to REQUIRE an entry. It's fine if the field is left blank.

What determines whether the validation requires entry, vs checking for valid format only if there is an entry?

Sign in to reply to this post

Ray BorduinWebAssist

The "Server Validations" server behavior has a "Allow blank entry" option you can check to allow blank.

The form fields themselves have a "required" attribute you can remove to allow blanks.

Sign in to reply to this post

Justin@AdventDesign

Hmm... something else must be amiss then. They were all checked to "Allow Blank Entry". Just to be safe, I unchecked them and saved the changes. Then went back through and rechecked them all. It appears the last of the string stating "false" is what allows a blank entry, and according to the code that is what I have. However, it's still requiring entries on all those before proceeding.

"required" is no where to be found anywhere on the page.

Any other ideas? This is housed only locally so I don't have it up on a server I can point you to easily.

<?php
if ((isset($_POST["Insert"]) || isset($_POST["Insert_x"]))) {
$WAFV_Redirect = "".(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)) ."?invalid=true";
$_SESSION['WAVT_tblmasterinsert_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateDT((isset($_POST["dateinsert"])?$_POST["dateinsert"]:"") . "",true,"","","",false,"","","",false,1);
$WAFV_Errors .= WAValidateDT((isset($_POST["dateupdate"])?$_POST["dateupdate"]:"") . "",true,"","","",false,"","","",false,2);
$WAFV_Errors .= WAValidateDT((isset($_POST["datestart"])?$_POST["datestart"]:"") . "",true,"","","",false,"","","",false,3);
$WAFV_Errors .= WAValidateDT((isset($_POST["datestop"])?$_POST["datestop"]:"") . "",true,"","","",false,"","","",false,4);
$WAFV_Errors .= WAValidateNM((isset($_POST["weight"])?$_POST["weight"]:"") . "","","","",",.",false,5);
$WAFV_Errors .= WAValidateNM((isset($_POST["price"])?$_POST["price"]:"") . "","","","",",.",false,6);
$WAFV_Errors .= WAValidatePN((isset($_POST["phone"])?$_POST["phone"]:"") . "",false,true,false,7);
$WAFV_Errors .= WAValidatePN((isset($_POST["phone2"])?$_POST["phone2"]:"") . "",false,true,false,8);
$WAFV_Errors .= WAValidatePN((isset($_POST["fax"])?$_POST["fax"]:"") . "",false,true,false,9);
$WAFV_Errors .= WAValidatePN((isset($_POST["mobile"])?$_POST["mobile"]:"") . "",false,true,false,10);
$WAFV_Errors .= WAValidateEM((isset($_POST["email"])?$_POST["email"]:"") . "",false,11);

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

Sign in to reply to this post

Ray BorduinWebAssist

That server code looks correct. I'd need to test it in action to debug further. Can you put it up on a live site?

Sign in to reply to this post

Justin@AdventDesign

Yeah I was afraid of that. Let me set up a live server and post...

Sign in to reply to this post

Justin@AdventDesign

See PM

Sign in to reply to this post

Justin@AdventDesign

OK Live version up. See PM for access.

Sign in to reply to this post

Ray BorduinWebAssist

You are using regular expression validation, but your regular expression doesn't allow a blank option. Can I get FTP access? I can try to update your .js files to account for this scenario.

Sign in to reply to this post

Justin@AdventDesign

See PM

Sign in to reply to this post

Ray BorduinWebAssist

It looks like you are using a space when there is no value in the field. The space is what is keeping it from allowing it to pass as blank.

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