/    Sign up×
Community /Pin to ProfileBookmark

How do I make a form field that has to have a specific value?

I have an html form that I use javascript to validate that some fields are filled out before submitting… And it works fine.

But, lately I have been getting tons of spams using the form – I would like to add a field that asks a simple question – like 2+2 and have the person answer “4” before the form can be submitted.

But, I am a javascript Newbie and don’t know how to make it a required field and have a specific value before it can be submitted.

Can someone please help.

I appreciate any assistance you can provide…

Thanks.

JadeWhiskey

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@toicontienJan 26.2009 — Sounds like you need to use a form of Captcha. Search google for form captcha scripts. You'll need to implement this server side, as doing this client side could make it easy to bypass.
Copy linkTweet thisAlerts:
@JadeWhiskeyauthorJan 26.2009 — thanks. I just took a look - I would like to validate with text rather than images - I have used those before and I sometimes can't read them - so, I just wanted something easy. Any other ideas?

JadeWhiskey
Copy linkTweet thisAlerts:
@toicontienJan 26.2009 — Do the same thing, only implement it in server side code to make bypassing this measure less likely.
×

Success!

Help @JadeWhiskey spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...