I need to run two functions onclick. I can't get them both to work even when nested together

Viewed 1314

The HTML is:

<input name="submit"
       type="submit"
       class="button"
       value="Click Here"
       tabindex="13"
       onclick="return ValidateForm();" />

The ValidateForm() function has all the usual form validating code. The other function I can't get to run (except by itself it works fine..example

<input name="submit"
       type="submit"
       class="button"
       value="Click Here"
       tabindex="13"
       onclick="disDelay(this);" />

I tried putting them both after the onclick...example

<input name="submit"
       type="submit"
       class="button"
       value="Click Here"
       tabindex="13"
       onclick="return ValidateForm(); disDelay(this);" />

I also tried putting one the code in the same function with no success.

The function disDelay() is

function disDelay(obj){
    obj.setAttribute('disabled','disabled');
    setTimeout(function(){obj.removeAttribute('disabled')},10000);
}

It is to be used as a delay to keep the form from getting duplicate submissions from multiple clicks. The delay is at 10 seconds right now just for testing purposes. I need the validation and delay to work together.

3 Answers
Related