Hi Community,
How can i make checkbox visible/hidden based on previous DropDown value.
For ex - I have dropdown field as Product having values - KFC, Pizzahut.
I have different checkboxes values if user selects KFC or Pizzahut.
How can i show different checbox dynamically after user selects dropdwon value.
I don't want to show all checkbox value and then hide. Based on the choice KFC/Pizzahut corresponding Checkbox options should dynamically come in form.
Here is the code that i am trying. Please help me with this.
if( ri!readOnly, a!textField( label: "Product", labelPosition: "ADJACENT", value: ri!record.productGroupAffected.value, readOnly: true ), a!dropdownField( label: "Product", labelPosition: "ABOVE", instructions: "", helpTooltip: "", placeholderLabel: "--- Select a Value ---", choiceLabels: local!productGroupAffectedOptions.value, choiceValues: local!productGroupAffectedOptions, value: ri!record.productGroupAffected, saveInto: ri!record.productGroupAffected, required: false ) ), if( ri!record.productGroupAffected = "KFC", a!textField( label: "Tools Affected KFC", labelPosition: "ADJACENT", value: if( or(isnull(ri!record.toolsAffected), count(ri!record.toolsAffected.value)=0), "", joinarray(ri!record.toolsAffected.value, ", ") ), readOnly: true ), a!checkboxField( label: "Tools Affected KFC", labelPosition: "ABOVE", instructions: "", helpTooltip: "", choiceLabels: local!checkbox1Value, choiceValues: local!checkbox1Value, value: ri!record.toolsAffected, saveInto: ri!record.toolsAffected, required: false ) ), if( ri!record.productGroupAffected = "PizzaHut", a!textField( label: "Tools Affected PizzaHut", labelPosition: "ADJACENT", value: if( or(isnull(ri!record.toolsAffected), count(ri!record.toolsAffected.value)=0), "", joinarray(ri!record.toolsAffected.value, ", ") ), readOnly: true ), a!checkboxField( label: "Tools Affected PizzaHut", labelPosition: "ABOVE", instructions: "", helpTooltip: "", choiceLabels: local!checkbox2Value, choiceValues: local!checkbox2Value, value: ri!record.toolsAffected, saveInto: ri!record.toolsAffected, required: false ) ),
Discussion posts and replies are publicly visible
Some of the advice you got in your previous thread would likely be beneficial here as well (for example, someone suggested reading up on the SAIL recipes), but I will take a shot at this new use case.
You haven't given much info on what you would want the different checkbox values to be, but I'll assume Pizza Hut gets one set of food options and KFC gets a completely separate set - and the values will dynamically change when one or the other is picked.
I'll create everything using LOAD and WITH variables so this can be copied and pasted into a new interface editor without needing to worry about RI values, etc.
load( local!restaurantChoices: { {id: 1, name: "KFC"}, {id: 2, name: "Pizza Hut"} }, local!selectedRestaurant, local!menuSelection: {}, with( /* dynamically set the menu choices based on which restaurant is picked */ local!menuChoices: if( isnull(local!selectedRestaurant), {}, if( tointeger(local!selectedRestaurant) = 1, { "Fried Chicken", "Mashed Potatoes", "Cole Slaw", "Biscuits", "Gravy" }, if( tointeger(local!selectedRestaurant) = 2, { "Pizza", "Bread Sticks", "Salad Bar", "Soft Drinks" }, {} ) ) ), a!formLayout( /* assuming 17.1 or prior, btw... if using 17.2, change this to a!formLayout_17r1 */ firstColumnContents: { a!radioButtonField( label: "Chain:", labelPosition: "ADJACENT", choiceLabels: local!restaurantChoices.name, choiceValues: local!restaurantChoices.id, value: local!selectedRestaurant, saveInto: { local!selectedRestaurant, /* the below will clear the previous menu selection when the restaurant is changed */ a!save( local!menuSelection, {} ) } ), if( not(isnull(local!selectedRestaurant)), a!checkBoxField( label: "Make your food choices:", labelPosition: "ADJACENT", choiceLabels: local!menuChoices, choiceValues: local!menuChoices, value: local!menuSelection, saveInto: local!menuSelection ), {} ) } ) ) )
Let me know if this is close to what you're after.