Search Support
-
haritha gowrugariNovember 22, 2017 at 4:26 am #4815
Hi All,
I have to set Maxlength to TextArea
please provide a solution to this
Ex: I have to allow <=2000 chars
on input i am using return potential.length<=2000;
but while copypaste more than 2000 chars it has to trim extra chars s and allow 2000 chars . for this scenario return potential.length<=2000 not working
thanks,
Haritha Gowrugari.
SPARK SupportNovember 27, 2017 at 9:18 am #4823Hi Haritha,
The return statement passes true or false back to the the On Input event handler. If the return is false, then the value of the Text Area will not be set to the potential value.
What you are looking to accomplish is to set the value of the Text Area to a substring of the potential when the length is greater than a certain number of characters. For this, use me.setData():
if(potential.length>100){me.setData(“”);me.setData(potential.substr(0,100));};
The reason that I use setData(“”) first is to clear and potential and current value from the state variables before setting the value to the substring of potential. This way, the logic will evaluate the new potential if the user attempts to type or paste additional characters.
Regards,
Stephen P.
Daniel EstradaMay 29, 2018 at 12:01 pm #5167Hello…
Dont know if this is solved or not.. but im posting an issue. I have tried the solution and it works Ok. The problem right now i think is that the “On Input” event of the text Area control is not working as expected. Im using BPM 8.6 with BPM UI 8.6 and i need to unfocus then focus and write for the script to execute.
Anyone knows if this is the correct behavior?
Regards!
Daniel Estrada
SPARK SupportJune 20, 2018 at 10:52 am #5197Hi Daniel,
Try this example:
1. Add a Text control and Output Text control to a CSHS
2. Add this code to the On Input event: ${Output_Text1}.setData(potential.length);
You should note that the Output Text will display the length without losing focus from the Text control.
Regards,
Stephen P.
-
|
You must be logged in to reply to this topic.