Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Javascript Form Re: Javascript Form

#49018

Hey Chris – I’ve actually run into a similar scenario. I handled it by setting the form action using JavaScript or jQuery. This way if someone without JavaScript enabled tries to submit the form, the page just posts to itself and doesn’t go anywhere.

Here’s a jQuery solution:

$('#contactform').attr('action', 'post.php');

Or just the plain JavaScript one:

document.getElementById('contactform').action = 'post.php';