Solved

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

Posted on 2007-11-27
3
1,090 Views
Last Modified: 2013-12-16
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.
0
Comment
Question by:Homer2040
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
jcoehoorn earned 500 total points
ID: 20361367
I could be wrong, but I don't think there is a multiple-click issue with ASP.Net or the wizard control; it's sort of taken care of for you, making this whole problem moot.  When you click the first time, the form submits and can't submit again until the page has finished loading.  By this time if validation has failed multiple clicks are safe, because nothing will happen when the form is re-submitted.

Like I said at first, though, I'm not 100% sure on that and you'll want to do some googling to verify this statement before relying on it.
0
 

Author Comment

by:Homer2040
ID: 20366146
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.
0
 

Author Closing Comment

by:Homer2040
ID: 31411287
Sorry for the delay in closing this question.
Used a variation of this suggestion so I'll award the points.

H.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question