close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Using validation to prevent P.O. Box addresses and shipping to outside of 48 states.

Thread began 9/27/2017 11:00 am by jlowery | Last modified 9/28/2017 2:01 pm by Ray Borduin | 77 views | 16 replies |

jlowery

Using validation to prevent P.O. Box addresses and shipping to outside of 48 states.

My client wants to disallow P.O. Boxes for shipping. Is it possible to use the jQuery Validation for this? If so, what reg ex do I put in the Address 1 / Address 2 fields via the dialog? I tried the solution found here: https://stackoverflow.com/questions/16722720/how-to-negate-po-box-regex - but wasn't successful.

I also need to make sure that shipping is not allowed to Alaska, Hawaii or international locations. How would I do that?

Sign in to reply to this post

jlowery

A quick follow-up... I also tried the various reg ex found here: https://stackoverflow.com/questions/5680050/po-box-regular-expression-validation

While they worked to prevent P.O. Boxes in various forms (box, Box, PO box, etc.) they also blocked standard addresses.

And I solved the issue of disallowing shipping for Alaska, Hawaii and non-US countries - just removed those options from the select lists.

Sign in to reply to this post

Ray BorduinWebAssist

Are you trying to do client or server side validation? Regex isn't very good at preventing patterns. It is better for forcing a particular pattern. I can come up with a work around for you, but it depends on the type of validation you are using.

Sign in to reply to this post

jlowery

I can go either way. I was using the JQuery Form Validation dialog 'cause it was the first one I saw and generally I like to validate on blur, but I'm okay with doing it onSubmit. Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

I think a server validation is easiest.

You can use non-blank validation with a value like:

php:
<?php echo(preg_match("/p(ost)?[ |\.]*o(ffice)?[ |\.]*(box)?[ 0-9]*[^[a-z ]]*/",$_POST['addressfieldname'])?"":"1"); ?>



This technique allows you to essentially test for the opposite of a regular expression. You are matching the specific pattern of a po box address instead of matching an address that doesn't have a po box. Then validating that it doesn't match that expression.

Sign in to reply to this post

jlowery

Cool. Where do I plug this in?

Sign in to reply to this post

Ray BorduinWebAssist

When you do server validation for non blank validation... that is the value you validate. (of course update the form field name with yours)

Sign in to reply to this post

jlowery

I found the Server Validation sb in Data Bridge, which I just re-installed, but I can't get it (or anything else) to open the first time. I get a flash of a dialog box and no way to validate the installation. What do I do?

Sign in to reply to this post

Ray BorduinWebAssist

It sounds like the secondary installer didn't run.

You should install data bridge with dreamweaver closed.

Then next time you open dreamweaver it should run the secondary installer.

Then you have to close and open dreamweaver one more time before accessing the functionality.

Sign in to reply to this post

jlowery

yeah, I had to uninstall and re-install for it to fire. Okay, I added a server validation to the page, but I don't understand how to plug in the code you sent. Here's what I have now:

<?php 
if (isset($_POST["CheckoutWizard_submit"]) || isset($_POST["CheckoutWizard_submit_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_checkout_712_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Address_1"]))?$_POST["Address_1"]:"") . "",false,1);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"checkout_712");
}
}
?>
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...