Can I mark a field invalid from javascript?

You could use the customValidity function for this purpose.

If you add a customValidity message to the field, it becomes invalid. When you set the message as an empty string, it becomes valid again (unless it is invalid because of other reasons).

field.setCustomValidity("Invalid field."); will make the field invalid.

field.setCustomValidity(""); will make the field valid unless it fails an HTML5 constraint.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)