Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

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>

 
Suggest Edit

Published January 31, 2016 - Updated October 8, 2020

Did you find this content helpful? Yes No

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us