Support Article
How do you prevent the paste event into a field?
SA-5822
Summary
Developers need the ability to be able to prevent users from pasting into certain textfields.
Error Messages
Not Applicable
Steps to Reproduce
Not Applicable
Root Cause
Developers need the capability to limit the users' paste ability
Resolution
This issue is resolved through the following local change:
Modify the generated HTML to catch the onpaste event.
From:
<input data-ctl <pega:include name="ClientValidation" type="Rule-HTML-Property" /> id="PropertyName" value="<pega:reference name='$this-value' mode='NORMAL' />" name="<%=tools.getActive().getEntryHandle()%>" type='text' ></span>
To:
<input data-ctl <pega:include name="ClientValidation" type="Rule-HTML-Property" /> onpaste="event.returnValue=false;" id="PropertyName" value="<pega:reference name='$this-value' mode='NORMAL' />" name="<%=tools.getActive().getEntryHandle()%>" type='text' ></span>
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.