Hi,
I have one validation rule on my text field. After clicking on submit button validation is working fine but data is getting save in DB.
What could be the issue ?
Discussion posts and replies are publicly visible
I have used the following code and entered the duplicate celltwo value.
load( local!isShowWhen: false(), local!mapData:{{"id":1,"oneCell":"AAA","twoCell":"BBB","threeCell":"CCC","fourCell":"DDD"},{"id":2,"oneCell":"OOO","twoCell":"LLL","threeCell":"KKK","fourCell":"XXX"}}, local!Data:{{"id":1,"oneCell":"PPP","twoCell":"QQQ"},{"id":2,"oneCell":"RRR","twoCell":"SSS"}}, local!index:1, a!formLayout( label: "Form", contents: { a!gridLayout( label: "", emptyGridMessage: "No Records Available", headerCells: { a!gridLayoutHeaderCell( label: "ID", align: "LEFT" ), a!gridLayoutHeaderCell( label: "Cell 1", align: "LEFT" ), a!gridLayoutHeaderCell( label: "Cell 2", align: "LEFT" ), a!gridLayoutHeaderCell( label: "Cell 3", align: "LEFT" ), a!gridLayoutHeaderCell( label: "Cell 4", align: "LEFT" ) }, columnConfigs: { a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "1" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "1" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "2" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "2" ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: "2" ) }, rows: a!forEach( items:local!mapData, expression: { a!gridRowLayout( contents: { a!textField(value:local!mapData[fv!index].id,saveInto:local!mapData[fv!index].id), a!textField(value:local!mapData[fv!index].oneCell,saveInto:local!mapData[fv!index].oneCell), a!textField(value:local!mapData[fv!index].twoCell,saveInto:local!mapData[fv!index].twoCell), a!textField(value:local!mapData[fv!index].threeCell,saveInto:local!mapData[fv!index].threeCell), a!textField(value:local!mapData[fv!index].fourCell,saveInto:local!mapData[fv!index].fourCell)
} ) }
)
) }, validations:if( contains( touniformstring( a!flatten( { local!mapData.twoCell, remove( local!mapData.oneCell, wherecontains( local!Data[local!index].id, local!mapData.id ) ) ,local!mapData.threeCell, local!mapData.fourCell } ) ) ,tostring( local!Data[local!index].oneCell ) ), "This cell is duplicate.", "" ), validationGroup: "Submit", buttons: a!buttonLayout( primaryButtons: { a!buttonWidgetSubmit( label: "Submit", validationGroup: "Submit", style: "PRIMARY" ) }, secondaryButtons: {} ) ))
Output: