Announcement

Collapse
No announcement yet.

Attach Javascript to Admin Buttons?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Attach Javascript to Admin Buttons?

    Is there any facility for attaching javascript code, such as an "Are you sure" dialog, to the turquoise Update button on an admin screen?

    Specifically I'm on the admin screen for a Utility module I've written. If the user clicks the Update button after checking a specific checkbox, I want to confirm that they really intend to do what the checkbox indicates.

    I've tried dynamically attaching the form onsubmit handler, and to the button onclick handler, but neither works.
    Susan Petracco
    NetBlazon

    1.866.400.2444

    _____________________________________________

    Like us on Facebook

    #2
    Update: I was having trouble with the iframes, but attaching it dynamically does work. But I can't figure out how to stop the form from submitting if the user clicks the Cancel button in the confirm dialog. I've tried RemoveEvent() calls with no luck.

    Maybe I just need to make my own button. This javascript stuff is really thorough and robust...and complicated.
    Susan Petracco
    NetBlazon

    1.866.400.2444

    _____________________________________________

    Like us on Facebook

    Comment


      #3
      I would recommend creating your own buttons, with your own JS. Using the Miva Merchant stuff only works when you want to RECREATE the same experience, otherwise you end up fighting to overcome certain behaviors.
      Gordon Currie
      Phosphor Media - "Your Success is our Business"

      Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
      phosphormedia.com

      Comment


        #4
        Thanks Gordon. I'll go with that. I've likely been at it too long today.
        Susan Petracco
        NetBlazon

        1.866.400.2444

        _____________________________________________

        Like us on Facebook

        Comment


          #5
          As a simpler approach: when one of my admin pages has a button that can do something critical, such as delete a lot of data, I often add a "Confirm" checkbox to the page. If the user accidentally hits the dangerous button, it won't succeed unless the box is checked. The checkbox is coded so that it returns to the unchecked state whenever the page is refreshed.
          Kent Multer
          Magic Metal Productions
          http://TheMagicM.com
          * Web developer/designer
          * E-commerce and Miva
          * Author, The Official Miva Web Scripting Book -- available on-line:
          http://www.amazon.com/exec/obidos/IS...icmetalproducA

          Comment


            #6
            Kent. that's a good idea. I went with the separate button already but this is another viable alternative. Thanks!
            Susan Petracco
            NetBlazon

            1.866.400.2444

            _____________________________________________

            Like us on Facebook

            Comment

            Working...
            X