Mark required fields conditionally based on other fields
"Puppet Environment" is a required field for provisioning new hosts. However, the form does not flag this field as being required. Other required fields have an "*" next to them to denote them as being required.
As it turned out, the puppet environment is required field only when a puppet master is selected on the host.
It would be nice to have a possibility to switch required flag based on the rest of the form. The similar behavior can be found at subnet form and I support other places too. Since we don't want to extend already complicate JS code for host form, I suppose this will be possible after we refactor that or reimplement our form helpers.
#3 Updated by Ohad Levy almost 2 years ago
- Subject changed from Mark required fields conditionally based on other fields to Mark required fields conditionally based on other fields
What is the right behavior? Should we not show/disable the field? (E.g don't show environment if puppet master is not selected?) Or rather explicitly say that you want puppet first (and then select both)?
#4 Updated by Marek Hulán over 1 year ago
Today we update the host form based on what user selects (e.g. provisioning method). For now I think just hiding the fields until user selected puppet master is good enough. Although that would mean extending existing host form JS. If we go this way, we should look at other more complicated forms, such as interface or subnet forms.