View Full Version : FORMS - submit button
Yesideez
05-17-2005, 09:29 PM
How do you make the submit button hide itself when it's clicked?
It's been causing me a bit of a headache as I can't seem to figure this one out!
juanmanuel
05-17-2005, 10:49 PM
paste this code and observe the behavior, it uses jasvascript for changing the values of the css properties that allows you to hide items.
<input type="submit" name="sbSample" value="hidden visibility " onclick="this.style.visibility = 'hidden'"/>
<input type="submit" name="sbSample" value="display none" onclick="this.style.display = 'none'"/>
<input type="submit" name="sbSample" value="normal" />
Yesideez
05-18-2005, 12:08 AM
That's awesome! Many thanks ;)
mwinter
05-18-2005, 11:10 AM
As with most things in browser scripting, the style object should be detected before blindly used:
<input ... onclick="if(this.style){this.style.visibility='hidden';}">You might want to be careful when taking this sort of action. If the user agent saves the state of a document when storing it in the history, a user could return to that document - for example, in the event of a network problem when submitting - to find no way of submitting it.
The best way to prevent problems with multiple submissions is by writing your server-side code with this in mind. Decide how a second submission should be treated - for example, just an error to be shown to the user, or a correction of previous values - and implement accordingly. It's the only sure way of dealing with the problem, and very necessary if sending two (or more) submissions in quick succession could be used as a exploit.
Mike
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.