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!
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!
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" />
That's awesome! Many thanks![]()
As with most things in browser scripting, the style object should be detected before blindly used:
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.Code:<input ... onclick="if(this.style){this.style.visibility='hidden';}">
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
Bookmarks