View Full Version : textarea validation

11-11-2010, 08:28 AM
on html i named my textarea as features, is the code below correct cause is does not validate.

if (document.forms.myform.features.value == "")

11-11-2010, 09:07 AM
Insufficient data to say something.

Philip M
11-11-2010, 09:13 AM
The syntax is

if (document.formname.elementname.value == "") {
if (document.forms[0].elementname.value == "") { // assuming that there is only one form

but form validation of the pattern if (document.formname.elementname.value == "") is barely worthy of the name, and virtually useless, as even a single space, an X or a ? will return false, that is pass the validation. Numeric values, such as zip codes and phone numbers, should be validated as such. Ditto email addresses. This topic has been covered many times before in this forum.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.