-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config fields get populated in JSON config even if not displayed #2208
Comments
Update: After re-reading the issue, I realized that there are problems when the form has hidden fields. To clarify:
Maybe this could be done by removing the fields from the DOM and then adding them back (minus the user entered values). |
Per the Angular JSON schema documentation, I have tried using
If the "foo" property is present, then the "bar" property is required. I tried using the
but this didn't work I tried assigning a function to the
This caused the entire form to fail to display. I have tried this with the current config-ui, using ajsf |
I don't thinking dependencies is implemented into the framework. |
You are right, they are not fully implemented:
|
Update: If any user entered value is deleted when a field is dynamically hidden, then dynamically hidden field values will not be submitted by the form.
Addendum: dynamically hidden via
as the author meant to add/remove fields from the form. |
Describe The Bug
When creating a config schema, you can use the
condition
property to show or hide a field based on the value of another field.For example, let's say that I have an iPad that may or may not have cellular capability.
In the config schema I add a required checkbox (boolean) field named
hasCellular
.Then I add a non-required textbox (string) field named
phoneNumber
, with condition"return model.devices[arrayIndices].hasCellular === true;"
In Config UI, I go ahead and configure in the Plugin Config window an iPad that has cellular:
hasCellular
checkbox, and the fieldphoneNumber
is displayed.0123456789
in fieldphoneNumber
.Then I realize my mistake: this iPad does not have cellular capability! So I uncheck
hasCellular
and the the fieldphoneNumber
is hidden. I click the Save button.If in Config UI, I go to Settings -> General -> JSON Config and look at the json, it will show:
While this is a valid configuration per the schema, it logically makes no sense. My expectation would be that if the field
phoneNumber
is not displayed, then it is not part of the configuration of this device, therefore it would not appear in the json.Logs
No response
Config
No response
Homebridge UI Version
4.62.0
Homebridge Version
1.8.4
Node.js Version
22.9.0
Operating System
macOS
Environment Info
Using hb-service
Raspberry Pi Model
None
The text was updated successfully, but these errors were encountered: