How to disable button?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ljCharlie
Forum Contributor
Posts: 289
Joined: Wed May 19, 2004 8:23 am

How to disable button?

Post by ljCharlie »

Is this how to disable a button?

Code: Select all

$btnNextDisable=" disable";
echo "<input name='btnClick' type='submit' id='btnNext' value='Next -- >' $btnNextDisable>";
It doesn't work though.

ljCharlie
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

you can do it with javascript.

Code: Select all

<input name='btnClick' type='submit' id='btnNext' value='Next -- >' onclick='javascript:btnNext.disabled = true;'>
should work.
ljCharlie
Forum Contributor
Posts: 289
Joined: Wed May 19, 2004 8:23 am

Post by ljCharlie »

Thanks I got it worked now. I didn't know that the word disable suppose to be disabled with the "d" at the end.

ljCharlie
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

disabled="disabled" is the proper attribute and value

that way, even if js is off, it will work
Post Reply