Ruchitha Posted August 20 Report Share Posted August 20 HOW CAN I ADD THE MINIMUM CHARACTER FOR THE TEXT AREA. Quote Link to comment Share on other sites More sharing options...
0 CoopperBackpack Posted August 22 Report Share Posted August 22 Hello @Ruchitha, If this is the Submission form, you may test this code in the Footer section (disable the HTML editor before pasting the code): <script> document.addEventListener('BeforeFormSubmit', textAreaHandler); document.addEventListener('DataPageReady', clearMessageHandler); const textAreaField = document.querySelector('textarea[id*="InsertRecordField_name"]'); //replace Field_name with the needed field name function textAreaHandler(event){ const textAreaLength = textAreaField.value.length; if(textAreaLength < 10) { // 10 is the minimum length, should be customized event.preventDefault(); textAreaField.setCustomValidity('The value must contain 10 characters and more'); //customize the message textAreaField.reportValidity(); return; } else{ textAreaField.setCustomValidity(''); } } function clearMessageHandler(){ textAreaField.addEventListener('input', () => { textAreaField.setCustomValidity(''); }) } </script> When the user clicks the 'Submit' button and the number of characters is less than needed this message will be displayed (for example): Hope this helps! Ruchitha and chumkirebzi 2 Quote Link to comment Share on other sites More sharing options...
0 Ruchitha Posted September 3 Author Report Share Posted September 3 Hi @CoopperBackpack, Just wanted to say a big thanks for helping me out with that question! Your advice was spot on, and I really appreciate you taking the time to help me out. CoopperBackpack 1 Quote Link to comment Share on other sites More sharing options...
0 chumkirebzi Posted October 14 Report Share Posted October 14 Hi Everyone! Just wanted to add to @CoopperBackpack's great solution. In the following code: const textAreaField = document.querySelector('textarea[id*="InsertRecordField_name"]'); //replace Field_name with the needed field name The InsertRecordField_name can be changed to EditRecordField_Name if this is an update form. This link may help. Good luck! Quote Link to comment Share on other sites More sharing options...
Question
Ruchitha
HOW CAN I ADD THE MINIMUM CHARACTER FOR THE TEXT AREA.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.