Codeasearch.com - Search your code with us Login | Register | Contact us
  Forums > Php > Need code for deactive date input type
thiyaghuck
Posted on Dec 8, 2008
Join Date: November 2008
Location: India ( chennai )
Posts: 14
 
Need code for deactive date input type  

Hi,
I have a radio button say,active and inactive.if the button is active the date input type should be active and if the user clicks the inactive radio button the date input type should be inactive.Can anyone give me the source code for this.

Thanks in advance,
thiyaghu.

benaya
Posted on Dec 9, 2008
Join Date: June 2007
Location: India ( Chennai )
Posts: 90
 
RE : Need code for deactive date input type  

Hi,
Go with this code. I have created one function to check true or false to disable the textbox.

<script language="javascript">
function getValue(id) {
$strBoolen = (id==1) ? false : true;
document.getElementById("txtDate").disabled = $strBoolen;
}
</script>
<form>
Active <input type="radio" name="rdStatus" id="rdStatus" value="A" onclick="getValue(1);" />
InActive <input type="radio" name="rdStatus" id="rdStatus" value="InA" onclick="getValue(2);" /> <br /><br />
Date <input type="text" name="txtDate" id="txtDate" />
</form>

If you have any doubts let me known.

 Hot Discussion
Go Tech launches Android tablet for Rs 3,999...
Sony targets retailers with quick sales pitches and rew...
Share and discover new activities with Google Schemer...
Samsung gets 9 mn preorders for Galaxy S3: Report...
Google revamps search engine to think like a person...
 
 Discussion Topics
IT News
Php
Javascript
Technology Updates
Asp.Net
MySql
Ajax
Html
Fedora
Software Testing
Asp
Java
General
Flash
Ruby on Rails