Home › Forums › JavaScript › Javascript Form › Re: Javascript Form
April 27, 2011 at 5:54 pm
#49018
Tim_at_PlattFormAd
Member
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';