I have input field, and want the each word form it - to check against the array of (predefined - forbiden words).
I already have delimited them,a nd basically created an array of them.
So is there a built in function inside JavaScript to check one against another or if someone has the code.
Thanks Ahead!
JavaScript: comparing values with an array members
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
...
Well in that case yes,
But my idea was to do the checking on the client side - for all those who use my site accordingly - both sides are better (in speed, processing ...)
And of course if someone tries to abuse that - backup is in PHP - so it is only executed when the JS is not used.
Is this ok, from the expert's point of view.

But my idea was to do the checking on the client side - for all those who use my site accordingly - both sides are better (in speed, processing ...)
And of course if someone tries to abuse that - backup is in PHP - so it is only executed when the JS is not used.
Is this ok, from the expert's point of view.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Normally when using Javascript you would check both on the client side (correcting where necessary). Then you would also check server side (PHP) as though no Javascript was used. Those with Javascript have the advantage of no page reload for initial checking but no invalid data can be used/hacked on the server. Design for no Javascript then build additional Javascript features, not the other way around.