Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to add custom validator to oj-select-one? it dosent have any validators property as per ojet doc

3501904Jun 18 2019 — edited Feb 10 2020

how to add custom validator to oj-select-one? it dosent have any validators property as per ojet doc.

Comments

Andrew Bennett

It doesn't support them at all, I'm not sure why you'd want to have a validator on it though? It will only show options that you have made available and nothing else can be done with the component. The only thing I can think of is you want to make it a required field in a form and show the red border if they don't fill it out, but the required property deals with that.

Andy

John JB Brock-Oracle

adding to what Andy said, if you want to do any kind of validation on the content that is made available to the select component, you would do it in the viewModel directly against the data as it came back from the REST call (or whatever method) BEFORE you pass it to the select component.  The select list is simply a representation of the data that is passed to it.

Jan Stanicek-Oracle

a different usecase might be cross-component validation where I need to set oj-select-one compone invalid based on validation result of another component. I usually set some flag and re-run validation on field, which depend on the flag and the validation "fails". This is not possible.

1 - 3

Post Details

Added on Jun 18 2019
3 comments
161 views