Javascript validating forms on assumption true

Whenever you try to hack something, it just feels wrong and you are forced to look at your problem from a different perspective.

The benefit is the resulting solution is usually much more modular and portable.

As a "workaround" I'm currently using this code in my JS-function which basically sets all "fields" to dirty before validation is triggered: My use case: I have a checkbox for "use gravatar" where the user can enable/disable using a Gravatar profile pic.

If disabled, it will use a stock profile pic, unless they upload their own. Then after I went and watched fireworks with the family, got home, and started searching again, I stumbled across this issue (luckily).

I have had several occasions where I’ve had to write my own directives, providers, filters, etc.

Here's a group of inputs which demonstrate the example.

Below is a simple example of a login form, where we keep the “Login” button (i.e.

“call to action”) disabled until the form is valid: Result: The above example is functional and works fine.

By decorating your field elements with the correct attributes, angular validation will occur automatically and let you know when a field (and in turn the form) is valid or invalid.

In addition you can use some conditional css classes to highlight invalid fields to the user.

Javascript validating forms on assumption true