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
10 replies
Subscribers
10 subscribers
Views
5082 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Hello Everybody, Does anyone know how to make a text/paragraph field
Jin Pheh
Certified Associate Developer
over 9 years ago
Hello Everybody,
Does anyone know how to make a text/paragraph field only required when the user tries to submit via a specific button? Currently validations on form elements do not trigger when they are blank and I can't use the "required" option since I need to check the validation only when clicking a specific button. I have created a dummy snippet that demonstrates the problem:
load(
local!comment,
a!formLayout(
firstColumnContents: {
a!paragraphField(
value: local!comment,
saveInto: local!comment,
validations: if (len(local!comment) = 0, "You must enter a phrase.", ""),
validationGroup: "comment"
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidgetSubmit(label:"Validate", validationGroup: "comment"),
secondaryButtons: a!buttonWidgetSubmit(label:"Cancel")
)
)
)
OriginalPostID-139172
OriginalPostID-139172
Discussion posts and replies are publicly visible
Top Replies
venkats533
over 9 years ago
+1
try using validationGroup - on the specific button. define validation on the text box or paragraph filed. read forum recipes for sample code.
0
shamec
over 9 years ago
I'm not sure if this represents your actual use case but in this case you can use the "required" property on your comment and then set the "skipValidation" flag to true for you cancel button. If your usecase is something else other than cancel where you would need to validate on both buttons then this won't work...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
utkarshs
over 9 years ago
Well you can try writing your condition in required field for example if value for your button is "test" and you are using BtnAction as your variable to store it then you can write the condition in required that if (ri!BtnAction="test", {Value if true}, {})
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
utkarshs
over 9 years ago
I would like to add that in value if true you simply write true(), and in value if false simply write false() I hope this helps
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
venkats533
over 9 years ago
try using validationGroup - on the specific button. define validation on the text box or paragraph filed. read forum recipes for sample code.
Cancel
Vote Up
+1
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mohanp
over 9 years ago
Refer link below, hope it will address your problem.
forum.appian.com/.../SAIL_Recipes
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jegadeeswaran
over 9 years ago
Please try this:
validations: if(len(local!comment) = 0,a!validationMessage(message: "len(local!comment) = 0", validateAfter: "SUBMIT"),"")
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
best
Certified Senior Developer
over 9 years ago
load(
local!comment,
a!formLayout(
firstColumnContents: {
a!paragraphField(
value: local!comment,
saveInto: local!comment,
required : true,
validationGroup: "comment"
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidgetSubmit(label:"Validate", validationGroup: "comment"),
secondaryButtons: a!buttonWidgetSubmit(label:"Cancel")
)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
thomas1803
over 2 years ago
[deleted]
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Richard Michaelis
Certified Senior Developer
over 2 years ago
in reply to
thomas1803
can you insert your code?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
over 1 year ago
in reply to
Richard Michaelis
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel