Re: [thelist] JavaScript Validation for Pull-Down Menus and Radio Buttons — R E S O L V E D

Jono ox4dboy at comcast.net
Fri Dec 10 17:54:08 CST 2004


On Dec 10, 2004, at 4:23 AM, Andrew Clover wrote:

> Jono <ox4dboy at comcast.net> wrote:
>> <SCRIPT LANGUAGE="JavaScript">
> Time for nit-pick-fun! ;-)
> <script type="text/javascript"> if you care about validation
>>     var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
>>     if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
> You're trying to strip leading and trailing spaces, right?
> ...

Andrew, thanks for the tips, although I have no idea what your 
suggestions mean.  I cannot look at "/^(\s*)([\W\w]*)(\b\s*$)/;" and 
decipher what that means.  I am not too accustomed to writing 
Javascript, I just hack out what I can pick up here and there.  All I 
was trying to do was make sure that users enter info into all of the 
required text fields, checked the required radio buttons, and selected 
an option from the require pull down menus.  I tried to write up a 
tutorial type lesson in my last post (at the bottom), in case someone 
like me came along in the future with the same question, and is swift 
enough to search the archives.

It would be great if someone (hint, hint) wrote a VERY EASY to 
understand tutorial on the correct way to implement Form field (all 
types of form elements) validation.  I did not find anything easy to 
follow online, but  I only had a few hours to research and get it done. 
  Dreamweaver has a WYSIWYG method to set up field validation, but it 
only seemed to work for text fields?



More information about the thelist mailing list