filmov
tv
How to Block URL in Text Field Using JavaScript in Formidable Form in WordPress

Показать описание
In this wordpress tutorial for beginners you will learn how to restrict user to enter or add urls / link in text field and text area section using custom javascript snippet in " Formidable Forms – Contact Form Plugin, Survey, Quiz, Payment, Calculator Form & Custom Form Builder " in wordpress website. So we are going to disable or prevent any links start with https / https / https: / http: / www. and when users add on specific field then show javascript alert and form submission not done and show error that urls are not allowed in text and textarea field in form in wordpress.
** Use this Code to Blocked User to Add URL.
jQuery(document).ready(function($) {
$('#field_ex63').on('input', function() {
var inputValue = $(this).val();
var urlPattern = /(https?:\/\/[^\s]+)/g; // Regex pattern to match URLs
alert('URLs are not allowed in this field.');
$(this).val(''); // Clear the field if a URL is detected
}
});
});
---------------------------
*** In script code add your field id...
#url #field #text #textarea #link #form #code #urls #https #http #www #formidable #form #plugin #wordpress #wordpresstutorial #webtaskwithhassan #hassangilani
** Use this Code to Blocked User to Add URL.
jQuery(document).ready(function($) {
$('#field_ex63').on('input', function() {
var inputValue = $(this).val();
var urlPattern = /(https?:\/\/[^\s]+)/g; // Regex pattern to match URLs
alert('URLs are not allowed in this field.');
$(this).val(''); // Clear the field if a URL is detected
}
});
});
---------------------------
*** In script code add your field id...
#url #field #text #textarea #link #form #code #urls #https #http #www #formidable #form #plugin #wordpress #wordpresstutorial #webtaskwithhassan #hassangilani