I need to put a condition on one of the columns in an editable that I'm using. The code that I'm currently using is not working. See the code below. There is a dropdown field in the grid and I have the condition on the 'required' attribute in bold.
=a!gridRowLayout( contents: { a!textField( label: "Application Name" & ri!indexRoles, value: ri!itemsRoles[ri!indexRoles].applicationName, saveInto: ri!itemsRoles[ri!indexRoles].applicationName, required: false, readOnly: true ), a!dropdownField( label: "Approved", labelPosition: "ABOVE", placeholderLabel: "--- Select a Value ---", choiceLabels: cons!YesNo, choiceValues: cons!YesNo, value: ri!itemsRoles[ri!indexRoles].approved, saveInto: ri!itemsRoles[ri!indexRoles].approved, required: if(ri!rejectApplicationsYN = "Return to Customer",true(),false()), validations: {} ), a!imageField( label: "delete " & ri!indexRoles, images: a!documentImage( document: a!iconIndicator("REMOVE"), altText: "Remove", caption: "Remove " & ri!itemsRoles[ri!indexRoles].applicationName, link: a!dynamicLink( value: ri!indexRoles, saveInto: { a!save(ri!itemsRoles, remove(ri!itemsRoles, save!value)), /* When modifying the size of the array used in a!applyComponents, */ /* make the same change in the "token" array variable */ a!save(ri!itemsTokenRoles, remove(ri!itemsTokenRoles, save!value)) } ) ), size: "ICON" )
Discussion posts and replies are publicly visible
you have written correct code only. For editable grids, it doesn't show up a * mark on the column. But if you try to submit without a value then the form will not be submitted.
Here is the same code I tried and its working for me.
= a!formLayout( label: "Lorem Ipsum", instructions: "Lorem Ipsum", firstColumnContents: { a!gridLayout( headerCells: { a!gridLayoutHeaderCell( "Col1" ), a!gridLayoutHeaderCell( "Col2" ), a!gridLayoutHeaderCell( "Col2" ) }, rows: a!gridRowLayout( contents: { a!textField( label: "Application Name" & ri!indexRoles, value: ri!itemsRoles[ri!indexRoles].applicationName, saveInto: ri!itemsRoles[ri!indexRoles].applicationName, required: false, readOnly: true ), a!dropdownField( label: "Approved", labelPosition: "ABOVE", placeholderLabel: "--- Select a Value ---", choiceLabels: { "Yes", "No" }, choiceValues: { "Yes", "No" }, value: ri!itemsRoles[ri!indexRoles].approved, saveInto: ri!itemsRoles[ri!indexRoles].approved, required: if( ri!rejectApplicationsYN = "Return to Customer", true(), false() ), validations: {} ), a!imageField( label: "delete " & ri!indexRoles, images: a!documentImage( document: a!iconIndicator( "REMOVE" ), altText: "Remove", caption: "Remove " & ri!itemsRoles[ri!indexRoles].applicationName, link: a!dynamicLink( value: ri!indexRoles, saveInto: { a!save( ri!itemsRoles, remove( ri!itemsRoles, save!value ) ), /* When modifying the size of the array used in a!applyComponents, */ /* make the same change in the "token" array variable */ a!save( ri!itemsTokenRoles, remove( ri!itemsTokenRoles, save!value ) ) } ) ), size: "ICON" ) } ) ) }, secondColumnContents: { /* Add components here for a two-column form */ }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidgetSubmit( label: "Submit", style: "PRIMARY", saveInto: {} ) }, secondaryButtons: { a!buttonWidgetSubmit( label: "Cancel", style: "NORMAL", value: true, saveInto: ri!cancel, skipValidation: true ) } ), validations: {} )
output: