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
4 replies
Subscribers
7 subscribers
Views
2895 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Portal Form
mohammedi
Certified Lead Developer
over 8 years ago
Hi All,
I have worked with Tempo forms, i need edit a portal form to add a validation on number of characters in a field.
I was able to achive giving a message saying you have crossed the allowed limit, but i want to add by how much they have exceeded.
For ex:-If character limit is 20 if user enters 25 character i want you show a message you have exceeded the limit by 5 characters.
I couldn't get the entered value in validation message as window api doesn't work nor it is saving into the activity class parameter used to save in the form.
Appreciate your help.
OriginalPostID-231190
Discussion posts and replies are publicly visible
Parents
0
Bob
over 8 years ago
For portal forms you are pretty much stuck with JavaScript for validations -- below is one function I have used for limiting length in text fields.
/* After each character is typed the text length is checked. When the maximum text limit
is exceeded an alert pops up to notify the user and any extra characters are truncated.
The function will also works for text that is pasted into the field. The same function
can be used for any or all of the text fields on a form, with the exception of rich text fields.*/
// Usage: textLimit("simpleParagraph", 500); [attached to keyup Event]
function textLimit(field, maxLimit) {
var textareaValue = window.FormAPI.getValue(field).id;
if (textareaValue.length > maxLimit) { // if too long trim the field
textareaValue = textareaValue.substring(0, maxLimit);
var msg = "You have reached the maximum number of characters (" + maxLimit + ") allowed in this field.";
asi.alert(msg); // pop up a message to alert user
window.FormAPI.setValue(field, textareaValue);
}
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Bob
over 8 years ago
For portal forms you are pretty much stuck with JavaScript for validations -- below is one function I have used for limiting length in text fields.
/* After each character is typed the text length is checked. When the maximum text limit
is exceeded an alert pops up to notify the user and any extra characters are truncated.
The function will also works for text that is pasted into the field. The same function
can be used for any or all of the text fields on a form, with the exception of rich text fields.*/
// Usage: textLimit("simpleParagraph", 500); [attached to keyup Event]
function textLimit(field, maxLimit) {
var textareaValue = window.FormAPI.getValue(field).id;
if (textareaValue.length > maxLimit) { // if too long trim the field
textareaValue = textareaValue.substring(0, maxLimit);
var msg = "You have reached the maximum number of characters (" + maxLimit + ") allowed in this field.";
asi.alert(msg); // pop up a message to alert user
window.FormAPI.setValue(field, textareaValue);
}
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data