Bug #7450
closed
We mark not-required fields as required
Added by Marek Hulán over 10 years ago.
Updated over 6 years ago.
Description
If the validator has some condition (:if => $smt, :unless => $smt) we shouldn't mark the field as required. In this case we simply can't tell without AJAX call because validity may depend on another field of the form. Btw there was a project translating AR validations to javascript (client side validations) but IIRC it's discontinued. Also it was quite big thing.
Do you have an example field where this is wrong? There's an override option which can be passed into the form helper to disable it, we just need to know which field(s) require it :)
Indeed, that should use options[:required] unless it's nil, and only then fall back to is_required.
Yup, will send a PR shortly. I thought it would be also useful to make is_required?
aware of conditions and if some is present, return false (probably makes sense in most cases?). Thoughts?
- Status changed from New to Ready For Testing
- Target version set to 1.7.3
- Pull request https://github.com/theforeman/foreman/pull/1766 added
- Pull request deleted (
)
- Assignee set to Marek Hulán
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Translation missing: en.field_release set to 21
- Related to Bug #7560: add :required => true on host fields that have conditional validation if host.managed? added
- Related to Feature #21678: Mark required fields conditionally based on other fields added
Also available in: Atom
PDF