PDA

View Full Version : Speicficy one rule for textareas and one for everything else


pthompson2002
09-25-2002, 04:50 PM
I have some form validation script which, when a form is submitted, highlights incorrect text.
I would like to know if there is a way that I can this validation allow to work only for textareas or textboxs and ignore everything else like checkbox and radio buttons that are in the same form.
I know it will be some kind of if statement, that would say roughly


if (textarea or text) {
--------------------------
}
else
{
--------------------------
}

cheers Pete

adios
09-25-2002, 04:55 PM
var el = document.myform.myelement;
if (el.type == 'text' || el.type == 'textarea') {.....

|'text'|'textarea' | 'radio' | 'checkbox' | 'select-one' | 'select-multiple'|
|'hidden'|'button'|

http://www.faqts.com/knowledge_base/index.phtml/fid/129

beetle
09-25-2002, 05:19 PM
Depending on what you validation requirements you have, you may be able to use my validator, fValidate (see the link in my signature)