xhtml form with selection list

I need to create a form which uses an appropriate input device (eg. text box) which will allow the user to select the basis for a search. the user should be able to choose between the following options:
*customer last name
*customer number
*order number

so when the user selects one option or a radio button the text box should become active, otherwise it should be inactive.i've done upto the radio button. now need some more help on how to get the text boxes active.
[494 byte] By [shipwreck99] at [2007-11-20 11:31:43]
# 1 Re: xhtml form with selection list
Here's how you would disable an input field:
var searchInput = document.getElementById("search");
searchInput.disabled = true;
andreasblixt at 2007-11-8 0:43:22 >
# 2 Re: xhtml form with selection list
Use the disabled attribute.

<script type="text/javascript">
function checkselected(obj){
if(obj.value == 'text1'){
document.getElementById('text1').disabled = false;
document.getElementById('text2').disabled = true;
}
else{
document.getElementById('text1').disabled = true;
document.getElementById('text2').disabled = false;
}
}
</script>

<input type="text" name="text1" id="text1">
<input type="text" name="text2" id="text2" disabled>

Text 1: <input type="radio" name="selecttext" value="text1" onchange="checkselected(this)">
Text 2: <input type="radio" name="selecttext" value="text2" onchange="checkselected(this)">
PeejAvery at 2007-11-8 0:44:20 >
# 3 Re: xhtml form with selection list
thanks...worked...:D
shipwreck99 at 2007-11-8 0:45:21 >
# 4 Re: xhtml form with selection list
Glad to hear it. Good luck with the rest! :thumb:
PeejAvery at 2007-11-8 0:46:21 >