gnlehcar
Posts: 15
|
| Posted: 07/31/2008, 12:16 AM |
|
Hi all!!
Do anyone know how to disable a button?
I have tried the following code in "on click"(client side) but it doesn't work..
document.RecordForm.ButtonA.disabled = true;
I have searched on this forum..some said to make the button invisible..but I just want to make it disable..is it possible in codecharge? or I missed something in the code?
Thanks a lot!!
_________________
Rachelbo |
 |
 |
mrachow
Posts: 509
|
| Posted: 07/31/2008, 12:30 AM |
|
When it is sufficient for you to disable the button on form/page submit you can do the following.
In html mode add an attribute "inside" the input tag of that button. in server event Before Show depending on your condition set that attribute to string disabled or nothing (empty string).
_________________
Best regards,
Michael |
 |
 |
gnlehcar
Posts: 15
|
| Posted: 07/31/2008, 2:56 AM |
|
Thanks Michael!
But if I am going to disable the button depending on the value in a textbox called "textboxA".
"textboxA" is inside a record form, which retrieves the value from my database and is set to be invisible.
I have written the following code in "On Load"(client side of Record Form):
if(document.RecordForm.textboxA.value == 1)
document.RecordForm.ButtonA.disabled = true;
I have got the following error:
document.RecordForm.textboxA.value is null or not an object
does this mean that I cannot get the value from the textbox if it is inside a form??
Thanks for your help!
Best wishes,
Rachel
_________________
Rachelbo |
 |
 |
aondecker
Posts: 58
|
| Posted: 07/31/2008, 3:59 AM |
|
try doing
document.getElementById("TextBoxA").disabled = true
|
 |
 |
gnlehcar
Posts: 15
|
| Posted: 08/01/2008, 2:47 AM |
|
Thanks aondecker~
but...i still can't disable the button..T^T
_________________
Rachelbo |
 |
 |
aondecker
Posts: 58
|
| Posted: 08/01/2008, 4:01 AM |
|
A cheap get around would be have an onclick function for that button something like this.
button code = <input type = "whatever" name = "whatver" onclick = "Cancel()">
then make a Cancel function in javascript
function Cancel()
{
return false;
}
That should allow the button to be pressed but nothing will happen since the function is returning false.
EDIT----
just make an onclick event through codecharge on the button and just say "return false". That makes nothing happen when it is clicked.
|
 |
 |
Gena
Posts: 591
|
| Posted: 08/01/2008, 4:11 AM |
|
if you look here http://www.motleysoft.com/ContactUs.php and press "Send now" button you will see it disabled.
code is:
<script>
/*Submit Once form validation*/
function submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}
</script>
_________________
Gena |
 |
 |