[WSG] More on forms

2012-05-19 Thread coder

Hi all,

I've been looking at stuff like this  (check for these chars and disable 
submit button if present):


function check(node)
 {
  var re = new RegExp('[\?\\[\\]]', 'g');
  document.getElementById('sub').disabled = re.test(node.value);
 }

What I'm asking now is, is there an equivalent function using words instead 
of characters?  I would like to make words such as 'ranking' 'SEO' 'search' 
'engine'  etc disable the submit button. I've looked, but can't find 
anything. As you'll have guessed, I'm no good at JS!


Thanks,

Bob 




***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
***



Re: [WSG] More on forms

2012-05-19 Thread David Dorward
 
On 19 May 2012, at 10:04, coder wrote:
  var re = new RegExp('[\?\\[\\]]', 'g');
 What I'm asking now is, is there an equivalent function using words instead 
 of characters?

In a regular expression bar will match bar while [bar] will match b or 
a or r. Just don't use the square brackets.

(You should also use regular expression literals ( /bar/ instead of new 
RegExp(bar) ) as they avoid having to escape things for regex and then escape 
them again for the string.)

-- 
David Dorward
http://dorward.me.uk



***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
***



[WSG] Out of the Office Re: WSG Digest

2012-05-19 Thread Janet Jaffke
I am currently out of the office until May 22. If you need immediate
assistance please contact Jon Kavanaugh at extension 75779.

Best Regards,

Janet Jaffke

-- 
•
Janet Jaffke
Director Content Strategy and UI
Illinois Institute of Technology
3300 S. Federal
Chicago, IL 60616
312.567.3155
•


***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
***