Hi everyone,
I have a form on a website where the form action is as follows:
<form id="catwebformform22024" name="catwebformform22024" method="post">
I’m using the following code to prevent spam bots on the form so it fills in the action url on keypress.
$( "#catwebformform22024" ).on( "keypress", function( event ) {
var action = $("#catwebformform22024").attr("action");
if ( typeof(action) === "undefined" || action === null || action === "" ) {
var url = "/FormProcess.aspx"
var params = "?WebFormID=100340&OID=17489470&OTYPE=1&EID=0&CID=0";
$( "#catwebformform22024" ).attr("action",url + params);
}
});
I want to do something similar on another form on a new website.
The form action currently looks like this:
<form action="https://www.mysite.com./contacts/index/post/" id="contactForm" method="post">
To try and get it to work I added a name attribute and value to the form element as follows:
<form action="https://www.mysite.com./contacts/index/post/" id="contactForm" name="contactForm" method="post">
Then changed the code to the following:
$( "#contactForm" ).on( "keypress", function( event ) {
var action = $("#contactForm").attr("action");
if ( typeof(action) === "undefined" || action === null || action === "" ) {
var url = "/FormProcess.aspx"
var params = "?WebFormID=100340&OID=17489470&OTYPE=1&EID=0&CID=0";
$( "#contactForm" ).attr("action",url + params);
}
});
The problem is I don’t know what the value for url and params should be.
I wondered if someone could help me out?
Would appreciate any advice.