You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get the rendering correct for the if then else where the condition is of another enum field within an object. The condition of one of the values will render a field that has a dropdown of enum objects, in the form of oneOfs, as that seemed to be the only way to prevent object Object being rendered in the drop down.
To get the drop down to render it needs to have type string, however, when I do this, the validator wants the type to be string but the value is this object of values.
Here is my current if then
{ "if": { "properties": { "gas": { "enum": ["Yes"] } } }, "then": { "properties": { "gas_supplier": { "type": "string", "title": "Select the name of the Utility Supplier", "$ref": "#/definitions/singleSupplier" } } }, "else": { "properties": { "gas_supplier": { "type": "string", "title": "Select the name of the Utility Supplier", "$ref": "#/definitions/supplierCode" } } } }
Here is my any of structure, but not showing the list in full:
"supplierCode": { "title": "Select the name of the Utility Supplier", "oneOf": [ { "title": "AIRTRICITY", "const": {"name": "AIRTRICITY", "code": "11111112"} }, { "title": "AIRTRICITY ELECTRIC", "const": {"name": "AIRTRICITY ELECTRIC", "code": "111111111"} } ] }
Any suggestions would be appreciated, I'm trying to do it this way as I'm trying to simplify our current solution that uses a custom autocomplete widget to display the name label with the code value associated, we then did extra formData manipulation to force the value for both name and code into the right place of the formdata
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to get the rendering correct for the if then else where the condition is of another enum field within an object. The condition of one of the values will render a field that has a dropdown of enum objects, in the form of oneOfs, as that seemed to be the only way to prevent object Object being rendered in the drop down.
To get the drop down to render it needs to have type string, however, when I do this, the validator wants the type to be string but the value is this object of values.
Here is my current if then
{ "if": { "properties": { "gas": { "enum": ["Yes"] } } }, "then": { "properties": { "gas_supplier": { "type": "string", "title": "Select the name of the Utility Supplier", "$ref": "#/definitions/singleSupplier" } } }, "else": { "properties": { "gas_supplier": { "type": "string", "title": "Select the name of the Utility Supplier", "$ref": "#/definitions/supplierCode" } } } }Here is my any of structure, but not showing the list in full:
"supplierCode": { "title": "Select the name of the Utility Supplier", "oneOf": [ { "title": "AIRTRICITY", "const": {"name": "AIRTRICITY", "code": "11111112"} }, { "title": "AIRTRICITY ELECTRIC", "const": {"name": "AIRTRICITY ELECTRIC", "code": "111111111"} } ] }Any suggestions would be appreciated, I'm trying to do it this way as I'm trying to simplify our current solution that uses a custom autocomplete widget to display the name label with the code value associated, we then did extra formData manipulation to force the value for both name and code into the right place of the formdata
Beta Was this translation helpful? Give feedback.
All reactions