Imagine a scenario where you’re collecting specific data through an online form, and you want to ensure that users manually enter their responses instead of copy-pasting them. This is crucial for maintaining data integrity and security, especially in online exams, secure registration, or critical applications. With 123FormBuilder, you can prevent form respondents from copy-pasting their answers by using a custom script.
Let’s take email confirmation as an example. We want our respondents to confirm their email in a second field without copying the data from the first one.
This script will prevent users from copy-pasting details to our Email fields. You can use this script for any type of input field.
document.addEventListener('DOMContentLoaded', () => {
setTimeout(() => {
['000000000', '111111111'].forEach(id => {
const field = document.querySelector(`[data-role=control][data-id="${id}"] input[data-role=i123-input]`);
if (!field) return;
field.oncopy = () => false;
field.oncut = () => false;
field.onpaste = () => false;
});
}, 2000);
});
All you need to do is make sure to replace 000000000 and 111111111 with the IDs of your form fields. The field IDs can be retrieved from the Field details section on the right-side panel.
Once you’ve finished creating your script, you must upload it to a trusted server and provide the URL containing the script file in Advanced → Form → Add a JS script to your form. Learn more on how to add JS to your form here.
Here is a list of the most frequently asked questions. For more FAQs, please browse through the FAQs page.