CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Disable a button

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message
aondecker

Posts: 58
Posted: 07/31/2008, 3:59 AM

try doing

document.getElementById("TextBoxA").disabled = true
View profile  Send private message
gnlehcar

Posts: 15
Posted: 08/01/2008, 2:47 AM

Thanks aondecker~
but...i still can't disable the button..T^T
_________________
Rachelbo
View profile  Send private message
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.
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.