| Summary: | Can not make dynamic dialog drop downs required | ||
|---|---|---|---|
| Product: | Red Hat CloudForms Management Engine | Reporter: | myoder |
| Component: | Automate | Assignee: | eclarizi |
| Status: | CLOSED WONTFIX | QA Contact: | Shveta <sshveta> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 5.6.0 | CC: | jhardy, mkanoor, myoder, obarenbo, tfitzger |
| Target Milestone: | GA | ||
| Target Release: | cfme-future | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | service:dialog | ||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-30 15:29:09 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | Bug | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
myoder
2016-11-18 22:39:44 UTC
The way the documentation is written currently, there is no reason that the "required" error message should show up, since the drop-down is already pre-selected with a value. Even if you left off the default value part, it should still be pre-selected with the first value. The only way that you will see the "required" error dialog is if you make one of the values nil, for example:
$evm.object["values"] = {nil => "Nothing selected", "A" => "A", "B" => "B"}
Then, as long as you aren't setting a default value, the "Nothing selected" should be the first value and when you hit submit, you should see the "required" error message.
Well, the problem in this case is that the automate method hasn't run yet, which is what is setting the dialog field to "required" in the first place. It sounds like the dialog field needs to be tweaked to show the refresh button, load values on init, and then change the automate method to look at the other field that this drop down is "dependent" on, and not give correct values back until that field is filled out. Then if that field isn't filled out, you should still get the error that it is required. I believe this is the same customer in this talk topic: http://talk.manageiq.org/t/making-dynamic-dropdowns-required/1913/2. I think we can close this as it's apparent what happened. I think the best course of action is if the customer is concerned about performance due to the "load values on init", that the automate method has a short circuit "if" block so that the potentially expensive calculation isn't run unless whichever other field they're relying on is filled out. Something like this, maybe: dialog_field = $evm.object other_dialog_field = $evm.root.attributes["other_dialog_field"] dialog_field["required"] = true if other_dialog_field == "example" dialog_field["values"] = {nil => "Select something from other dialog field first!"} else # expensive calculation for the values dialog_field["values"] = values end |