Context
We have an interactive app whose select options are populated by calling an external API from form.yml.erb (OpenStack flavors). That call can legitimately fail — the API returns an empty array, times out, or raises. When it does, the form renders a select with no options, and the user can still hit Launch, submitting the session with a blank value for that attribute.
What we’d like to achieve
The form should be visibly invalid and the session should not launch. Either:
- the Launch button is disabled while a required form item has no available options, or
- the form renders an error state that blocks submission, with a message explaining why.
What we’ve tried
required: trueon the empty select — does not block submission. We understand from the docs thatrequired,minandmaxare client-side validation only, and a select with zero options doesn’t appear to be covered by that check.- Raising an exception from
form.yml.erb— this is what we’d naturally do to signal “the form is not usable,” but it doesn’t stay contained to the app’s form page. The exception escapes into the dashboard’s app-list rendering, so after it happens the interactive app stops appearing in the navbar dropdowns. - Conditionally omitting the form item and showing
form_header— this is our current workaround. It renders a clean explanation, but the Launch button is still live and submits with the attribute absent. form.jsto disable the submit button — works, but it’s client-side only, easy to bypass, and we’d rather express “this form is currently invalid” in the form configuration itself.
Questions
- Is there an existing, supported way to mark a rendered form as invalid/non-submittable from
form.yml.erb(a flag, a validation hook, or a specific error the controller is expected to catch)? - Should a required select with an empty
optionslist block submission, or is that explicitly out of scope for the current validation? - If the intended answer is “write
form.js”, would you accept a documented pattern (or a small built-in) for “dynamic options list is empty → disable launch and show this message”?
Environment
- OnDemand:
<4.0.1>