Results 1 to 4 of 4

Thread: FORMS - submit button

  1. #1
    Join Date
    Apr 2005
    Location
    Devon, UK
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default FORMS - submit button

    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!

  2. #2
    Join Date
    May 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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" />

  3. #3
    Join Date
    Apr 2005
    Location
    Devon, UK
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That's awesome! Many thanks

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    As with most things in browser scripting, the style object should be detected before blindly used:

    Code:
    <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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •