Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Prevent immediate validation of fields with values? #401

Closed
matt-allan opened this issue Aug 18, 2016 · 4 comments
Closed

Prevent immediate validation of fields with values? #401

matt-allan opened this issue Aug 18, 2016 · 4 comments

Comments

@matt-allan
Copy link

Hello,

I just updated and the changes from #350 are causing some problems for me. Here is what is happening:

  • I return the old input from the server for every input field, so the field is initialized with the old value.
  • I set the class 'has-error' on the form group if there is a server error and render a message.
  • When the validator initializes, it validates the field because of the changes that resolved Submit button not disabled with input type number, value=0 and min="10" #350
  • Since the field can only be validated server side, the validation passes.
  • After validation passes the 'has-error' class is removed, even though I have a server error.
  • Since this happens on initialization, the client doesn't have a chance to see the error state.

Here is a fiddle that might help explain what I'm talking about.

What do you think about making this behavior something that can be disabled?

@dortamur
Copy link

I have a similar issue.
I perform server-side validation, which is more thorough than the client-side validation, so in some instances, the client-side validator will think a field is valid, yet after submitting to the server, the server has determined it to be invalid, and has re-rendered the form with a form-group with 'has-error', and pre-populated error message.

Ideally, I'd like it to not run validation when the page first loads, until the field value is changed. And when it does run, to remove the server-side generated error text.

@chrisribe
Copy link

+1

@1000hz
Copy link
Owner

1000hz commented Nov 4, 2016

I think I'll revert the changes from #350 and leave it up to people who want that behavior to trigger validation themselves. See also #393.

@MrLexLewis
Copy link

+1

@1000hz 1000hz closed this as completed in 1ae1440 Dec 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants