Streaming live at 10am (PST)

[resolved] How do I disable form action and redirect? ( figured it out! )


#1

Hello! I am using webflow to quickly recreate nice looking html and css quickly. I made a form with some input fields in webflow. I exported the code from webflow to use all the css, html and animations. But now I don't want the form to do anything like redirecting the page(thus losing the form data), or submitting the data to webflow. I have my own Javascript function I call with the submit button. But it doesn't work because the webflow js/jquery keeps redirecting my form page and creating a http request, which I don't need it to do. How do I disable these functions without breaking the webflow code? ( like interactions )

For any lost souls out there with the same problem.
Put your function with 'onsubmit' in the tag.

onsubmit="function()"

In your function use the following code to prevent the page from generating a request
and resetting your form:

function(){

if(event.preventDefault)
    event.preventDefault();
else
    event.returnValue = false;

}


#2

I was unable to get this to work for me. It just redirects to the action url...


#3

Hi, probably an easier method, is to set the Action property of the form to a Hashtag “#” (without the quotes. Or you can also use the javascript void function as the html link:

`javascript:void(0);

Hopefully this helps, if not, let me know and I am happy to take a further look smile Cheers, Dave


#4