-
Notifications
You must be signed in to change notification settings - Fork 647
Question - Injecting custom validation on form fields #601
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
Comments
I used the onChange attribute to send the value of the input to a custom validator function. For example |
Thanks for the suggestion but the rendered form is client dependent and most of the users are researches who know nothing about programming. My idea is along the line of having a registry of validators per client and have a mechanism of identifying the field at parse time to inject the validator and let angular & schema-form take care of the rest. Right now I am playing with the JSON.parse(json, reviver). I thought the reviver can provide me the name of the field which can be the key to my registry. Once a validator is found, through the reviver I can change the parse JSON node and inject the validator. Cheers and waiting for some juicy solution ;) |
@kazoompa can you add validators to tv4 or via a directive by modifying the decorator templates? |
Closing due to lack of recent comments |
Hi,
I have been Google-ing a lot on this and I couldn't find any descent answer, here is our setup:
The form schema and definition are returned from our Java server to our Angular client as a JSON document. We would like to add a custom validator on a form field. Since the form definition is returned as a string JSON, we cannot have the $validators set on the field as described in the documentation. We need to parse the form definition, find the valid field and then add our custom validator on the fields $validators list. Is there any way to do this nicely?
Thanks.
The text was updated successfully, but these errors were encountered: