I've few questions to ask, those might be trivial issues but important.
1. I have set a grid level validation in an inline dynamic editable grid. Every time user generates a new row with add row link and tries to submit the form without filling any field, it shows up validation message. But it is showing for multiple times, i.e. times the number of rows generated. I want it to be like validation binds every unfilled field or row but should appear only once. Below is the screenshot of issue. Here it's appearing 3 times for 3 rows, I want it shows validation error message only once for all three rows.
2. Second issue is related to the first one, when user for example, first deletes any of the row using "X" and then again generates the new row back using add row link, validation message automatically appears for that, which shouldn't be the case. Below captured video shows the issue.
3. Getting a strange error:
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!gridLayout [line 6]: Rule 'l' has 1 parameters, but instead passed 0 parameters.
I am not using any "I" named rule, pls check the whole code below:
4.. I think, I might have addressed this one in my previous queries.
I have a dropdown with name "Request Type" having two choices "Supply" and "Service", and there is one "Item" textfield in which Item Name needs to be entered. When user selects a "Service", then "Item" value should be stored in "Service Type" table and for "Supply" in "Supply Type" table, which is occurring with the code I have written, but the issue is "If user suppose in between changes the "Request Type" from "Service" to "Supply", then "Item" value stored in "Service Type" CDT should return back to null state and newly entered "Item" value should store in "Supply Type" CDT, which is not coming up and it's retaining both Item values in both CDTs, i.e Ex- He entered "PC" for "Supply" but then changed it's "Request Type" to "Service" and entered Item as "S/w Installation", then as a result "Supply Type" CDT has Item value "PC", and with that "Service Type" CDT has Item value "S/w Installation", which shouldn't be the case i.e. Item value "PC" in "Supply Type" CDT should default back to null.
I have highlighted the code in comments:
a!localVariables( a!formLayout( label: "Create New Request", instructions: "Create a new Request Type|Maximum 5 requests can be created at a time", contents: { a!gridLayout( totalCount: count( ri!requestTypeRef ), headerCells: { a!gridLayoutHeaderCell( label: "Request Type*" ), a!gridLayoutHeaderCell( label: "Item*" ), a!gridLayoutHeaderCell( label: "Quantity*" ), a!gridLayoutHeaderCell( label: "Price ($)*" ), a!gridLayoutHeaderCell( label: "Comment*", align: "RIGHT" ), a!gridLayoutHeaderCell( label: "" ) }, columnConfigs: { a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 1 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 1 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "ICON" ) }, rows: a!forEach( items: ri!requestTypeRef, expression: a!gridRowLayout( id: fv!index, contents: { /* a!dropdownField( label: "request type " & fv!index, placeholderLabel: "---Please select value---", choiceLabels: cons!OSR_TEXT_ARRAY_REQUEST_TYPE, choiceValues: cons!OSR_TEXT_ARRAY_REQUEST_TYPE, value: index(fv!item, "RequestTypeName", {}), saveInto: fv!item.RequestTypeName, required: true ), a!textField( label: "item " & fv!index, value: if( ri!requestTypeRef[fv!index].RequestTypeName = "Service", index( ri!serviceTypeRef[fv!index], "ServiceTypeName", {} ), index( ri!supplyTypeRef[fv!index], "SupplyTypeName", {} ) ), saveInto: if( ri!requestTypeRef[fv!index].RequestTypeName = "Service", ri!serviceTypeRef[fv!index].ServiceTypeName, ri!supplyTypeRef[fv!index].SupplyTypeName ), required: true ),*/ a!integerField( label: "quantity " & fv!index, value: index( ri!request[fv!index], "Quantity", {} ), saveInto: ri!request[fv!index].Quantity, required: true ), a!floatingPointField( label: "price " & fv!index, value: todecimal( index( ri!request[fv!index], "Price", {} ) ), saveInto: ri!request[fv!index].Price, required: true ), a!paragraphField( label: "comment " & fv!index, value: index( ri!comment[fv!index], "Comment", {} ), saveInto: ri!comment[fv!index].Comment, required: true ), a!imageField( label: "delete " & fv!index, images: a!documentImage( document: a!iconIndicator( "REMOVE" ), altText: "Remove Request", caption: "Remove ", link: a!dynamicLink( value: fv!index, saveInto: { a!save( ri!request, remove( ri!request, save!value ) ), a!save( ri!requestTypeRef, remove( ri!requestTypeRef, save!value ) ), a!save( ri!serviceTypeRef, remove( ri!serviceTypeRef, save!value ) ), a!save( ri!supplyTypeRef, remove( ri!supplyTypeRef, save!value ) ), a!save( ri!comment, remove( ri!comment, save!value ) ) } ) ), size: "ICON" ) } ) ), addRowlink: a!dynamicLink( label: "Add New Request", value: null, showWhen: count( ri!requestTypeRef ) < 5, saveInto: { a!save( ri!request, append( ri!request, save!value ) ), a!save( ri!requestTypeRef, append( ri!requestTypeRef, save!value ) ), a!save( ri!serviceTypeRef, append( ri!serviceTypeRef, save!value ) ), a!save( ri!supplyTypeRef, append( ri!supplyTypeRef, save!value ) ), a!save( ri!comment, append( ri!comment, save!value ) ) } ), rowHeader: 1, validations: { a!forEach( items: ri!requestTypeRef, expression: if( or( isnull( ri!requestTypeRef[fv!index].RequestTypeName ), isnull( ri!request[fv!index].Quantity ), isnull( ri!request[fv!index].Price ), isnull( ri!comment[fv!index].Comment ) ), a!validationMessage( message: "Please fill all the Required* fields!", validateAfter: "SUBMIT" ), {} ) ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: cons!OSR_TEXT_BUTTON_SUBMIT, submit: true, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: cons!OSR_TEXT_BUTTON_CANCEL, value: true, saveInto: ri!cancel, submit: true, style: "NORMAL" ) } ) ) )
Thanks a lot in advance.
Discussion posts and replies are publicly visible
varunkumarb0001 said:Second issue is related to the first one, when user for example, first deletes any of the row using "X" and then again generates the new row back using add row link, validation message automatically appears for that, which shouldn't be the case. Below captured video shows the issue.
I believe the behavior you're seeing here is expected behavior. Once the validation condition has been triggered, all valid validation messages will show up instantly until the form is validated (and for any given field, the validation message should disappear once its conditions are met). This is simply the way validations work on SAIL forms.
Thanks @Mike, can we do something for the first one?
The first issue is tougher - in general, if you mark individual fields in an editable grid as Required and/or have other validations on them, then each individual field will display its failed validation status when the user tries to submit the form. There's no single answer for an easy way around this, other than perhaps experimenting and seeing if you can come up with a reasonable compromise. For instance, you could turn off the "required" setting for a particular field, and instead add a section-level or form-level validation that checks to make sure there are no blank entries for that field within the CDT array that you're saving into. This of course has pros and cons, since individual fields that are missing or have a failed validation state won't be individually called out by the form.
Thanks Mike, got your point...
I've all issues sorted out but there's a weird issue that I have dropdown field also as required field but while submitting the form every unfilled required field is coming with red border except that dropdown but it's validating but not getting red. Can you help with what I could be missing? Above is the whole code which I'm using...
This case is with every first required grid column, it doesn't show up red border around it whether you make it required or not, I think default behavior of Appian
I may have heard about this before - if so there's a chance that it's a known bug within Appian. Not "expected behavior" of course but perhaps something they know about. If I can find the previous thread here where someone else reported it (assuming i remember right) i'll try to post it here.
Sure Thanks...
Does this post seem to describe behavior matching what you're observing? It's probably the one I was thinking of.
Yes, that's the one I was looking for, You saved my day, Thanks Mike...