Oleg Konovalov a écrit :
I have made some progress and found a few interesting things:
1) I should use just onload="if (btn_id.disabled)",
I can't believe that works with other browser than IE (Win ?)
2) for some reason that always returns false,
see below
3) the other strange thing is that I can't use any curly braces in any
onload or onclick, doing:
onload="if (btn_id.disabled) { alert.window('some text'); }" gives error:
certainly same cause as (2)
"Oleg Konovalov" <ok******@verizon.netwrote in message
news:mpHSg.12807$2G1.1696@trnddc07...
>Hi,
I have a web application which is (among other things) doing large SQL
Insert's,
so sometimes it takes a while, user becomes impatient and clicks again (or
just does double-click),
so the same data is getting inserted again.
I was thinking of some simple solution in Javascript.
something like:
<input name=myBtn onclick="this.disable=true;" />
OK
>and
<body onload="if (document.myBtn.disabled) document.myBtn.disabled=false;"
/>
I do not understand why IE can't find an element of a form ?
(if what you said is true)
document.myForm.myElement.oneAttribute
where : myForm and myElement are names (not ID !) of those
document.forms['myForm'].elements['myElement'].disabled=true;
or
document.myForm.myElement.disabled='disabled';
<form name="myForm" .... >
<input type="submit" name="myElement" ... >
>...
</body>
Do you think that might work ?
yes (as told in my other post) if your code is correct :-)
>(that input is not a Submit button, the page actually reloads when any DB
transaction is done)
Why isn't it a submit ?
prefer to use a submit button and put your conditional function in a
'onsubmit' in form's tag
<form action="page.php" onsubmit="return myConditions();" ... >
myConditions() must return false to avoid send,
if all ok it must return true
>The complication is that the <bodyand <inputare in different files,
that's new ... !
one way to other, in fine, you display a single file, no ?
>i.e. if the button is in the "grandchild" of the <bodyform (child
includes the parent which includes a grandparent).
I understand nothing about your family where children give birth to
their parents and grand parents ... ! ?
Voodoo ?
>Do they really share a "document" ?
yes a virtual document but working as normal one
>Or is there a nicer solution ?
Hope so for your familly :-)
--
ASM