Menu

#37 Question regarding ButtonTester

open
nobody
None
5
2004-01-15
2004-01-15
No

Some buttons included on our web pages initially fire a
javascript function to display an alert to the user (e.g, a
confirmation to ensure they wish to save any changes).
Is there any way this can be handled or removed using
the ButtonTester and postback invoked without
changing the code on the web page?

Discussion

  • clifton f. vaughn

    Logged In: YES
    user_id=826251

    see reply about AnchorTester. With the modification I
    suggested, you can use this class to test just about any
    attribute on any html element.

     
  • Anonymous

    Anonymous - 2004-01-19

    Logged In: YES
    user_id=951603

    As our page was using an HTML Input Button of type=button
    with an onclick event to fire the javascript confirmation
    message and an onserverclick event to handle the postback,
    the html rendered is similar to the following:-

    onclick="if(!myJavascriptFunction()){ return false;}
    __doPostBack('Button1','')"

    Creating your own class which inherits from the ButtonTester
    allows you to expose the MyBase.PostBack
    (postBackScript:=postBackScript) which looks for the
    expression __doPostBack to submit the form. This has the
    effect of skipping the javascript function and just performing
    the postback event.

     
  • James Little

    James Little - 2004-08-26

    Logged In: YES
    user_id=499667

    nsargeant, should we change NUnitAsp to support this natively?

     

Log in to post a comment.