Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
8 replies
Subscribers
7 subscribers
Views
3140 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Hi All, I have 2 a!buttonWidgetSubmit (Button1,Button2) and 1 text field (F
upendram803
over 9 years ago
Hi All,
I have 2 a!buttonWidgetSubmit (Button1,Button2) and 1 text field (Field1) in my form. In my use case, if Button1 is clicked and Field1 is blank I need to display validation message at the end of form just above button. For this I am using validations property in the a!formLayout(). However, form is getting submitted instead of validating field.
Please find my code snippet below:
validations:{if(and(isnull(ri!Field1),ri!btnAction = "Button1"),,a!validationMessage(
message: "Please provide required value",
validateAfter: "SUBMIT"
),{})
It works fine if I remove ri!btnAction = "Button1" but I need to include button action in condition.
Is anyone come across such situation. Any help would be appreciated, TIA !!
OriginalPostID-181112
OriginalPostID-181112
Discussion posts and replies are publicly visible
0
sonalk
over 9 years ago
Hi Upendra,
The validations attribute works for field and is than associated to the validation groups. Configure the button to be a part of the same validation group. Please check the example from the forum link below:
forum.appian.com/.../SAIL_Design.html
Hope it helps!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sonalk
over 9 years ago
Also in the code snippet that you have shared the comma is placed twice after the and function. Please check once after correcting the syntax.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
upendram803
over 9 years ago
Thanks for reply Sonal !!
i want form validation means validation message at the bottom of the form just above button not on field. I tried that validation group also but ri!btnAction = "Button1" condn. not being checked, hence form is submitting. Is there any way to validate based on button value after clicking any of the button. Thanks !!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ram
Certified Lead Developer
over 9 years ago
Hi upendram803,
Please find the attached document contains the requested solution. Let me know if you have any issues.
Sample code.txt
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
upendram803
over 9 years ago
Hi akkramanir,
It works only on interface, Task is getting submitted while tried putting this rule in form.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Rahul Gundu
over 9 years ago
Try the below code. If the value of the button input type is Boolean then it's working as per our desire otherwise not.
/*
ri!buttonAction(Boolean)
ri!textValue(Text)
*/
a!formLayout(
firstColumnContents:{
a!textField(
label:"A",
value:ri!textValue,
saveInto:ri!textValue
)
},
buttons:a!buttonLayout(
primaryButtons:{
a!buttonWidgetSubmit(
label:"Submit",
value:true,
saveInto:ri!buttonAction
)
}
),
validations:a!validationMessage(
message:if(
and(rule!APN_isEmpty(ri!textValue),ri!buttonAction),
"Message",
null
),
validateAfter:"SUBMIT"
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ram
Certified Lead Developer
over 9 years ago
Hi upendram803,
Prepopulate the text variable with "null" and boolean variable with "true" in the user input task which is used in your process model and pass the created activity class variable i.e the text variable and boolean variable as rule inputs to the rule which you created, please check the below screenshot.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
adrianf
over 9 years ago
It seems that you only want the validation to appear for a certain button, but not another. If that's the case you may want to look into the concept of validationGroups. If a button and a formlayout (or a section layout etc) are in the same validation group, the validation will only be in effect on that particular button press. You will also have to set the other button to a different validation group
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel