[Javascript] Disabling the image submit button -- aspx

David Lovering dlovering at gazos.com
Fri Nov 14 09:50:04 CST 2003


Well, probably the first thing to do is assure yourself that the form is
being submitted.  You can put in the form declaration an event handler
reference "onSubmit='alert(\'now in submit state\')'" that will tell you
that.

Secondly, I've had some difficulties (probably due more to my own ignorance)
in jumping back and forth seamlessly between an ASP event handler and a
straight JavaScript one.  In general it is probably a good idea to write the
handler in whatever language you use for the event call, and vice-versa.
[This is one of those grey areas where neither documentation nor testing are
likely to have been very robust].

The other recommendation I'd make is not to use a flag variable to store the
state of prior submits.  Since the button event is disabled upon going
through the first submission, I'd simply rig the code to check whether or
not it is disabled, and use that to guide any follow-up actions.

Unless there is a terribly compelling reason to use ASP code, I'd stick with
the JavaScript exclusively.  After all, this IS the JavaScript List!

-- Dave Lovering

----- Original Message ----- 
From: "Guy Platt" <guy at webbnet.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Friday, November 14, 2003 1:05 AM
Subject: Re: [Javascript] Disabling the image submit button -- aspx


>
> Dave,
>
> Thanks for taking the trouble to look at my code and offering your
> replacement code.
>
> When I run this through the JS debugger in Mozilla 1.4 I see that the
> code is executing fine but is not producing the desired results. The two
> problems I have are:
>
> 1) the image used for the button does not change as a result of the
> disable.
> 2) The ASPX code is never called, almost as though the form is not being
> submitted. Would something in the JS code be stopping the form from
> being submitted the first time?
>
> regards
>  Guy
>
>
> David T. Lovering penned the following on 11/14/2003 12:23 AM:
>
> >Hmmm... maybe something like this would work better --
> >
> ><script LANGUAGE="JavaScript">
> >
> >
> > <snip>
> >
> >>     eval("ProceedButton.disabled = 'true'");
> >>     submitted = 'true';
> >>     return true;
> >>
> >>
> >     <snip>
> >
> >I haven't tested it with any rigor, but this looks better and conforms
somewhat to the
> >syntax issues etc.
> >
> >-- Dave Lovering
> >
> >
> >
> >
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list