First off, this is not the best way to do this. But if you’re not too concerned about aesthetics or the “right” way to do things (on the web, many ways exist to achieve a goal, so that’s a bit of a blanket statement), then this could help you out a lot.
The issue is with forms. Specifically disabling forms for those browsers that have their javascript turned off. Only a small fraction of people do this, but you do run across them.
So how to fix this?
The solution is remarkably simple. First off you modify your form so that the action is set to #null:
<form action=”#null” …>
Then, since you want to turn the form “on” for javascript-enabled browsers, you use javascript to change the action, with this line:
document.getElementById(‘form_name’).action = “process_file.php”;
Incidentally, I had tried disabling the submit button in the form, and then activating it with javascript. This doesn’t work, apparently there are some issues when you disable a submit button.

















Trackbacks