0

I am having trouble trying to enable and disable two buttons on the last step in my asp.net wizard control.

What I am trying to achieve is when the user clicks the finish button on the wizard control the user gets presented with the javascript confirm popup box, and when the user selects confirm:

1) It disables the finish button on the wizard control 2) It enables a button on my usercontrol to become enabled

Despite all my efforts, I am struggling to get this to work.

Here is a snippet of what I have tried to do on the finish button

   var answer = confirm("Click confirm if you wish to repeat steps and then click the repeat button on the screen");

   if (answer == true)
   {
    $("input[type=submit][id=*btnFinish]").click(function()
       {
         $("input[type=submit][id=*btnFinish]"].atr('disabled',true);
       });
   }

Can anyone help?

Andy5
  • 2,319
  • 11
  • 45
  • 91

1 Answers1

0

You have a spelling error

$("input[type=submit][id=*btnFinish]"].attr('disabled',true);
 ----------------------------------------^

Though you should be using .prop if using jQuery 1.6+

$("input[type=submit][id=*btnFinish]"].prop('disabled',true);
$("input[type=submit][id=*btnFinish]"].prop('disabled',false);

And you can remove the click function around it - since

and when the user selects confirm: - disable/enable

And just use the if/else statement you already started

if (answer){// <-- if they clicked ok

}else{

]
wirey00
  • 33,517
  • 7
  • 54
  • 65
  • Thanks. It also worked, but when the postback finished on the click of the finish button it all went back again to how it was. Any ideas? – Andy5 Oct 26 '12 at 21:02
  • It goes back because on postback the page refreshes and everything gets reset – wirey00 Oct 26 '12 at 21:03
  • Yep, is there away to do this as purely client side or some other solution – Andy5 Oct 26 '12 at 21:07
  • Yes.. you need to store the state in a cookie/DOM storage - or make an ajax call to get the current state from the db. Here's a link to DOM storage https://developer.mozilla.org/en-US/docs/DOM/Storage.. I'm sure you can google up the cookies pretty easily – wirey00 Oct 26 '12 at 21:09