Closed jariwalabhavesh closed 6 years ago
Dang, I just left this same issue. Oops.
This feature should definitely be allowed.
Hi, sorry @jariwalabhavesh for taking so long to answer. I thought about it and I guess I would be OK with having additional mechanisms to let developers write validation routines. However, the fact that both you and @j stumbled upon the exact same use case -- validating certain kinds of dates -- I also wonder if it would be simpler to just add better support for validating dates. For example, JSON Schema doesn't support minimum/maximum on dates, but maybe we could add some extensions that provide those fields when operating on date-time fields. Could you elaborate on what kinds of validations you need to perform on dates? I would be happy to review PRs that improve our support in this area.
Hi @glasserc , Very sorry for delay response. I am having validation like
To set error will be helpful to other widget as well when it is come's to custom widget. so user can validate data based on configuration passed to widget. For example: if i make custom widget to upload file, while uploading file if any error occur then i need to set error form widget.
OK, this sounds like a duplicate of #155.
Hi, i know its an old issue, but after spending couple of days without a hint, maybe here i will finally find an answer. How can raise an error from within a custom widget ?
i have a form with my custom widgets and also with customer-created widgets. some of those customer-created widgets may have custom validations, and i need to know how i should instruct them to raise validation errors.
Hi @snirotem, Did you figure out a way to raise error from within a custom widget? I am looking for solutions to the same problem.
I don't think it's currently possible. You may have to modify the validate
function somehow instead.
This is a big omission iyam, and should be put on the roadmap. Isn't it essential that a component governing user input can raise errors? And this is not a dupe of #155 as that pertains to jsonschema errors.
This should be re-opened as this is about custom widgets being able to raise errors (not all errors are schema based, i.e. when a widget is allowing schemaless yaml|json|whatever, but validates the input for correctness)
/reopen
This should be re-opened as this is about custom widgets being able to raise errors (not all errors are schema based, i.e. when a widget is allowing schemaless yaml|json|whatever, but validates the input for correctness)
Can you please make a new issue? This issue is pretty old and hard to understand -- a new issue will make it easier to consolidate and understand what the problem is.
Done: #2718
Prerequisites
Description
Can we set error from custom widget.??? Basically there is two way to manipulate and handle error:
transformErrors
validate
Example use case:
validate
but i need to write (copy/paste) same validate function for each form. But if it is possible to pass error to form directly from custom widget then we need no to set same validation for multiple form.I am not getting any kind of
error
property orsetError
function that allow me to set error in form's error object in custom widget.So is there any way to do it??
Thanks