Last activity: 26 Oct 2016 1:05 EDT
Text Area with limited characters
Scenario:There is a textarea where we want to user to allow upto 50 characters.Beyond this the user will not be able to type anymore.
Can anyone let me know how to implementt this?
***Updated by moderator: Marissa to moved from Pega Academy Community to Product Support Community; updated categories***
In Text Area control , Under "Presentation" find out Min/Max chanracter enter value as 50 in second text box which is for Max. This will also not allow user to enter more characters.
But if user copied a sentence of more than 50 charcters will truncated , you should be carefull with requirement.
agree with Pavan if you are using v7.x.
You can throw error message, if limit is crossed either through edit validate or validate rule
Thanks for posting your query on PSC.
For client side validation, you can use the suggestion by Pawan (that is using max and min attributes of the textarea control). Refer https://collaborate.pega.com/question/counter-text-input-working-wrong-chrome regarding this.
And for server side validation, you can use the suggestion by Dharanitharan(that is using Validate rule). Here, the error message will be displayed once the user submits the page.
Hope this answers.
In my case i m using Pega v6.2 so i m not abl to get the max and min characters for TextArea control.
Secondly,I have to use this requirement on a modal dialogue.I am using a button where there is no Submit action for which even if on click of the button it throws an error but its not persisting on the modal dialogue.The modal dialogue popup is getting closed even if there is an error.Please suggest how to proceed on this.
Then instead of flowaction Validate on change of that Text area action you can create an activity to call the validate rule or you can use property-set-messages or page-set-messages
Aaseya IT Services Pvt Ltd
My 2 cents on this. 3 possible options for V6.x
1) Property rule form to be updated with Max length.
Pros: Clean and neat ; Cons: The value gets truncated at the back end & the user doesnt know about it which is a bad design as it may truncate the important part of text
2) Edit validate rule
Pros: Best practice,Reusability Cons: There is an error message on screen for entering more characters. The user might truncate but then exactly how much he needs to is a bit of UI design issue
Pros: The end user is not allowed to enter more than x number of characters as he is no-more able to type in. You can save as any of the pxInputText or Text area controls and simply add the max characters to it. This will work the way it does in Pega 7.This is subtle and does job without any fuss & is reusable too. Cons: Not a Pega best practice to write custom controls.
Hope that helps
I have tried using a script having "onkeypress" jquery event.It worked.