PDA

View Full Version : Disable form Submission when JS disabled


Revan
06-24-2005, 10:05 AM
Okay, I am trying to disallow an user to submit the form when JS is disabled. This is to circumvent a bug where clicking submit multiple times produces unwanted effects.

I am currently using the following code:
<form action="script.php" method="post" onsubmit="return disable_form(this);">
<!-- teh HTML -->
<script type="text/javascript">
document.write('<input type="submit" name="submit" class="button" value="Submit" accesskey="s" />');
</script>
<noscript>
You will be unable to perform an action until you either enable JavaScript in your browser, or get a modern browser.
</noscript>
<!-- teh HTML -->
</form>

But the problem is, if I load the page with JS enabled, then disable it (either through the Web Developer Firefox extension or the Options menu), the entire protection scheme goes in ze toilet.

Is there anything I can do to combat this?

sabret00the
06-24-2005, 10:09 AM
process it with a custom redirect if on the redirect screen (!$jscript) spew error :)

Revan
06-24-2005, 10:28 AM
:surprised: I didn't even know there was such a thing :p
And it worked, thanks mate :)