Link to home
Start Free TrialLog in
Avatar of Homer2040
Homer2040

asked on

Need to re-enable submit button at end of a Wizard control.

Experts,

I have a wizard control with a FINISH button at the end that I disable onClick to prevent multiple clicks.
 However, if the page fails validation, the button remains disabled and further attempts to submit a
corrected page is not possible.

The button is wrapped in a FinishedNavigationTemplate container:
<FinishNavigationTemplate>
  <asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" Text="Finish" />
</FinishNavigationTemplate>

The onclick javascript is added in the page load:
  Button myFinishButton = (Button)Wizard1.FindControl("FinishNavigationTemplateContainerID$FinishButton");
  string script = String.Format("{0}.disabled = true;{0}.value='Please wait...';", myFinishButton.ClientID);
  myFinishButton.OnClientClick = script;

I think I need to re-enable the button on every page load (postback or not), but also need it to re-enable if
 a field that failed validation is corrected.

Any ideas?

Thanks.

H.
ASKER CERTIFIED SOLUTION
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Homer2040
Homer2040

ASKER

jcoehoorn,

I removed the code I was using to disable the button & change the text onclick and tested it...

ASP.NET & the wizard control still allowed multiple clicks and I received multiple entries in the db.

Thanks though.

So I guess I'm back to the original problem...

1. Need to disable button to prevent multiple clicks (have code that handles this), also display different text on the button (also have code to handle this).

Item #1 may be moot.

2. Need the button to re-enable (and change text back) after page validation fails so it can be resubmitted.

H.
Sorry for the delay in closing this question.
Used a variation of this suggestion so I'll award the points.

H.