0

I need to enable a disabled text box through php.Please inform me about the errors in the following code:

<input type= "text" name ="ch1" disabled = "true"
<?
if ( $_GET["e"] == 3 )
echo "disabled = 'false' ";
?>
/>
5
Contributors
14
Replies
20
Views
8 Years
Discussion Span
Last Post by diafol
0

This simply wouldn't work because this is how your source would look like.

<input type= "text" name ="ch1" disabled='true'
disabled='false'/>
0

Thanks for your reply. How it can be done, can you please guide?

This simply wouldn't work because this is how your source would look like.

<input type= "text" name ="ch1" disabled='true'
disabled='false'/>
0

Thanks for your reply. I need to enable a disabled text box as this text box will be disabled by default, so should i write:

<input type= "text" name ="ch1" <?php if(!S_GET['e'] == 3)  {echo "disabled=\"false\"";} ?>">
<input type= "text" name ="ch1" <?php if(!S_GET['e'] == 3)  {echo "disabled=\"disabled\"";} ?>">
0

If it is disabled by default and on certain condition, you want to enable it, you have to use javascript.

0

I need to enable it by using php.

If it is disabled by default and on certain condition, you want it to enable it, you have to use javascript.

0

As far as I know, once you have printed a html element, you can't change it (unless you use javascript). Even almostbob's code decides whether to enable or disable the textbox at runtime.

0

But the problem with java script is that it can be disabled by the user on browsers. There should be a way to implement it by php.

As far as I know, once you have printed a html element, you can't change it (unless you use javascript). Even almostbob's code decides whether to enable or disable the textbox at runtime.

0

<offtopic>
Strangely, http://www.w3schools.com/htmldom/prop_text_disabled.asp says textObject.disabled=true|false
But, when I use <input type= "text" id='ch1' name ="ch1" disabled='false' /> it doesn't work.. It still disables the textbox :S
</offtopic>
Anyways, I hope I am wrong and someone else have a way to enable already disabled textbox without using javascript.. :)

0

Yes I have checked this option also quoted by w3schools, but it is not working. I have searched and some tutorials quoted that "disable" and "readonly" properties can only have one value same like their name:

<input type="text" disabled= "disabled">

<offtopic>
Strangely, http://www.w3schools.com/htmldom/prop_text_disabled.asp says textObject.disabled=true|false
But, when I use <input type= "text" id='ch1' name ="ch1" disabled='false' /> it doesn't work.. It still disables the textbox :S
</offtopic>
Anyways, I hope I am wrong and someone else have a way to enable already disabled textbox without using javascript.. :)

0

What is the error in this code:

<input type="text" name="ch1" disabled= "true" id="ch1"
<? 
if( $_GET["e"] == 3 || $_GET["e"] == 4) 
 {   
echo "<script>{ document.getElementById('ch1').disabled = false; } </script>";
}
?>  />

It show an extra "/>" in output.

0
<input type="text" name="ch1" disabled= "true" id="ch1" />
<?
if( $_GET["e"] == 3 || $_GET["e"] == 4) {
echo "<script>document.getElementById('ch1').disabled = ''; </script>";
}
?>

:)

-1
if ($biller_status=='unpaid') {
        echo "<script>{ document.getElementById('checkbox').disabled = false; } </script>";
    }
0

Please consider the fact that this is a dead thread before posting and pushing this to the top of the heap. Thank you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.