Deactivate Submit Button...Help

Results 1 to 2 of 2

Thread: Deactivate Submit Button...Help

  1. #1
    Join Date
    Dec 1969

    Default Deactivate Submit Button...Help

    I have this code below that I got from a Java code warehouse. I thought it would work, but apparently it doesn&#039;t. <BR><BR>Can anyone see what&#039;s wrong?<BR><BR>In the FORM:<BR>&#060;input type="submit" name="Submit" value="Submit" onClick="disableSubmits();"&#062;<BR><BR>The Function:<BR>function disableSubmits (form) {<BR> for (var i = 0; i &#060; form.elements.length; i++)<BR> if (form.elements[i].type.toLowerCase() == &#039;submit&#039;) <BR> form.elements[i].disabled = true;<BR>}

  2. #2
    Join Date
    Dec 1969

    Default What a really roundabout way!

    You don&#039;t need that (not too well written) function.<BR><BR>&#060;input type="submit" name="Submit" value="Submit" <BR> onClick="this.disabled=true; return true;"&#062;<BR><BR>Presto.<BR><BR>BUT...<BR><BR>B UT that ONLY works in MSIE browsers. Search this forum for solutions that work with Netscape 4 browsers. This question gets asked about 2 or 3 times a month.<BR><BR>p.s.: The reason that crappy function didn&#039;t work is because you didn&#039;t call it correctly. You didn&#039;t pass a reference to the form to the code. <BR> onClick="disableSubmits(this.form);"<BR>but that&#039;s purely silly when you end up doing 100% the equivalent of <BR> this.disabled=true;<BR>anyway.<BR><BR>************ **<BR><BR>Oh...and you did NOT get that "from a [hl="yellow"]Java[/hl] code warehouse." You got it from a Java[hl="yellow"]Script[/hl] warehouse. Don&#039;t confuse the same. There&#039;s not a whole lot in common beyond the first four letters of the names.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts