Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validation behaviour on blur #41

Open
Vaevictus opened this issue Jan 22, 2017 · 4 comments
Open

validation behaviour on blur #41

Vaevictus opened this issue Jan 22, 2017 · 4 comments

Comments

@Vaevictus
Copy link
Contributor

Vaevictus commented Jan 22, 2017

Is there a way I can change the validation behavior? It seems to affect the demo page too.
If I load a form, I can immediately save it without actually firing any validation. I also want to validation errors to immediately load (the red ones) when I initialize it. Only after entering some data then removing it with backspace will show the "this field is required" error for example.

Additionally, and I think this is a more generic question with regards to react, but still related:

if I have

<mycontainer >

<SchemaForm />

<MySubmitButton />

</mycontainer>

How can I make the mysubmitbutton check the validity of the form prior to allowing the submit, or even bind the enablement status of the button to the validity status of the form?

thanks

@stevehu
Copy link
Contributor

stevehu commented Jan 26, 2017

These are all goog questions. The current released version should fire validation when the form is submitted. The demo is a little old. For the second question, do you have logic in your submit button? If not, you can use generated button. Otherwise, you csn call schema form api from you button.

@alexey-kuznetsov
Copy link

I have the same situation. This is my submit callback

sendCredentials: function(e) {
    e.preventDefault();
    let result = utils.validateBySchema(this.state.schema, this.state.model);  
    if (result.error !== null) {      
      console.log(result);     
    }
  },

It seems like a bug - if I submit form with incorrect fields, validation fires and I see this in console, but there are no indication at wrong fields in form

@stevehu
Copy link
Contributor

stevehu commented Apr 23, 2017

@alexey-kuznetsov From what you have describe it is a bug. I will try to reproduce and get it fixed. Thanks for your help.

@alexey-kuznetsov
Copy link

@stevehu embedded validation doesn't prevent form from submitting. It is not normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants