close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Preventing spam submissions that pass validation

Thread began 1/11/2021 8:33 am by Nathon Jones Web Design | Last modified 3/11/2021 8:12 am by Ray Borduin | 941 views | 9 replies |

Nathon Jones Web Design

Preventing spam submissions that pass validation

We've added Alphanumeric and Restrict Content validation to 5 standard fields in a contact form yet our clients are regularly bombarded with the following type of thing....

Name:
fUQZFwPGlsuRz

E-mail:
ronaldlynch2919@gmail.com

Telephone:
2850111433

Subject:
oDFdsMNgTnz

Enquiry:
ESoVIwnBgAUd

Is there a way to add validation that requires there to be at least two words, which would help the Name and Enquiry fields?
Is there a way to insist that the telephone number field starts with either a "+" or a "0"?
There's nothing we can do about the e-mail field. The details are false, but it's a legitimate e-mail format.

We don't want to go down the route of adding a CAPTCHA, or similar, just for a regular contact form. Is there anything else we could consider?
Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

You could use a Regular Expression to validate more specifics like requiring a space and certain characters in the beginning of a value.

This site has a lot of regular expressions you can probably search and find the one you want if you don't know how to write your own:
https://regexlib.com/?AspxAutoDetectCookieSupport=1

You could implement reCaptcha v3... That is an invisible captcha option that doesn't require the user to do anything.

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

Nathon Jones Web Design

Thank you Ray.

Have had a look at reCAPTCHA v3 - https://developers.google.com/recaptcha/docs/v3 - and have bound the challenge to the form button but we are still able to just submit the same old nonsense to the form and nothing is blocked?
Form URL - https://gallowayfisheriestrust.org/contact.php

Regarding regular expressions, how do we integrate/add an additional, custom, validation using a regular expression to our existing WA Server Validations behaviour on this page?

Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Server validations has a Regular Expression type validation you can apply.

There is server side code you have to add for reCaptcha v3 that you are probably missing.

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

Nathon Jones Web Design

What is wrong with this Regular Expresesion?

$WAFV_Errors .= WAValidateRX(((isset($_POST["FORMname"]))?$_POST["FORMname"]:"") . "","^([A-Z][a-z]+)\s([A-Z][a-zA-Z-]+)$",true,7);


It's supposed to force a user to enter two words seperated by a space, but it doens't work:
https://www.gallowayfisheriestrust.org/contact.php

Two pages attached.
Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Regular Expressions should be enclosed in slashes like:

$WAFV_Errors .= WAValidateRX(((isset($_POST["FORMname"]))?$_POST["FORMname"]:"") . "","/^([A-Z][a-z]+)\s([A-Z][a-zA-Z-]+)$/",true,7);
Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

I used the Regular Expression type validation in the Server validations behaviour and pasted the expression in from an example on the https://regexlib.com/?AspxAutoDetectCookieSupport=1 website, as you'd advised.

Is that an issue with the Server Validations behaviour?

Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

You just have to encapsulate regular expressions with slashes. That is how regular expressions work in php.

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

Nathon Jones Web Design

Yes, but shouldn't the WA Server Validation insert those, when applying a Regular Expression validation?
In the WA Server Validation wizard I inserted:

^([A-Z][a-z]+)\s([A-Z][a-zA-Z-]+)$



What you're saying is that I should have entered:

/^([A-Z][a-z]+)\s([A-Z][a-zA-Z-]+)$/



...because the behaviour isn't doing it, right?

Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Adding the slashes manually allows you to add modifiers after the slashes like i, m, or u, which gives you more flexibility in your regular expression generation. The reason that we don't add the slashes automatically is the same as why php doesn't.

See: https://www.w3schools.com/php/php_regex.asp

Sign in to reply to this post
Did this help? Tips are appreciated...
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...