Advertisement

05.05.2004 at 04:49PM PDT, ID: 20979523
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

Disable submit button after click (Interdev DesignerControl Button)... why isn't this easy?

Asked by E-Squared in Microsoft Visual Interdev

Tags: , , , ,

I have been blessed to be given a huge legacy of web code written in Visual InterDev 6.0. We are having a problem with duplicate orders being submitted when users click submit multiple times. I assumed this would be an easy fix... just disable the button on the first click, right?

Well, I couldn't figure it out. So we assigned it to the previously-senior-but-now-parttime-programmer who wrote most of the stuff in the first place and SHE couldn't figure it out.

I searched the web fruitlessly. The question is too specific, or too vague, or something, to be susceptible to easy search terms. (Suggestions welcome!)

My company understandably doesn't want me to spend days on such a simple problem, coming up to speed on all the ins and outs of interdev controls and writing/rewriting ASPs just to fix what should be a simple problem. I would really appreciate anyone's help.

The pages are VB .ASP and the submit button is some special Microsoft control and looks like this in the source page (not visible from inside interdev, but what is written out to the actual .asp file):

<!--METADATA TYPE="DesignerControl" startspan
<OBJECT
    classid="clsid:B6FC3A14-F837-11D0-9CC8-006008058731"
    height=27 id=btnSubmit
    style="HEIGHT: 27px; LEFT: 0px; TOP: 0px; WIDTH: 206px"
    width=206>
    <PARAM NAME="_ExtentX" VALUE="5450">
    <PARAM NAME="_ExtentY" VALUE="714">
    <PARAM NAME="id" VALUE="btnSubmit">
    <PARAM NAME="Caption" VALUE="">
    <PARAM NAME="Image" VALUE="images/ButtonSubmit.gif">
    <PARAM NAME="AltText" VALUE="Submit this new order.">
    <PARAM NAME="Visible" VALUE="-1">
    <PARAM NAME="Platform" VALUE="0">
    <PARAM NAME="LocalPath" VALUE="">
</OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Button.ASP"-->
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function _initbtnSubmit()
{
    btnSubmit.src = 'images/ButtonSubmit.gif';
    btnSubmit.alt = 'Submit this new order.';
    btnSubmit.setStyle(1);
}
function _btnSubmit_ctor()
{
    CreateButton('btnSubmit', _initbtnSubmit, null);
}
</script>
<% btnSubmit.display %>

<!--METADATA TYPE="DesignerControl" endspan-->

The event handler looks like this:

[<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
    Sub btnSubmit_onclick()
{Code to submit order here}
    End Sub
</SCRIPT>

When visiting the page, the client source shows the control rendered thus:

<A href="javascript:thisPage._fireEvent('btnSubmit','onclick');"><IMAGE border=0 name="btnSubmit" id="btnSubmit" src="images/ButtonSubmit.gif" alt="Submit this order.">

The easiest way to fix this, I thought, would be to disable the submit button. But, I don't have access to the inner javascript of the control when it is displayed or I'd just disable it from the client side:

"javascript:{control.visible=false or something!};thisPage._fireEvent('btnSubmit','onclick');"

So then I tried putting server-side code at the top of the btnSubmit_onclick event to disable or make the button invisible.

document.getElementById("lblresubmit").style.visibility = "visible"

Didn't work. I realized it probably had to be a client action. So I tried

Response.Write "<SCRIPT language=vbscript>document.getElementById('lblresubmit').style.visibility = 'invisible'</SCRIPT>"

(Well... I don't know if the syntax above is correct, but I did do it right when I was trying it.)

Which 'works' but the problem is that when you click the submit button, it refreshes the page (but doesn't navigate to a new one, yet, until the server response is received), and the response.write output ends up being first in the source, before <HTML>, when there IS no control yet.

I can think of several methods to prevent actual submission of the second and subsequent orders, but the best thing would be to disable the button (while it waits for a response from the server which loads a new page).

Ready to tear my hair out,

-E²

P.S. Thank you very much for your time!!!Start Free Trial
[+][-]05.06.2004 at 09:10AM PDT, ID: 11007273

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 10:36AM PDT, ID: 11008049

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2004 at 07:18AM PDT, ID: 11059380

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.13.2004 at 06:33PM PDT, ID: 11064719

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.10.2004 at 04:42AM PDT, ID: 11278175

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.11.2004 at 12:46PM PDT, ID: 11292013

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.11.2004 at 12:48PM PDT, ID: 11292031

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.14.2004 at 06:11AM PDT, ID: 11305948

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Interdev
Tags: button, disable, submit, click, after
Sign Up Now!
Solution Provided By: modulo
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32