PDA

View Full Version : Select Radio when Text Entered



abskure
04-04-2006, 01:23 AM
I would like a radio button to be selected when I focus on the accompanying text field. Here's what I have so far, I think I just have some type of syntax problem. Can anyone help? check red area....



<form name="propSearch" id="propSearch" action="index3.php" method="get">
<center>

<p>
<input type="hidden" name="option" value="com_wrapper">

<input type="hidden" name="Itemid" value="74">

<input name="KeyField" value="ListingID" type="radio">Search by MLS

<input name="ListingID" id="ListingID" class="small" value="Enter MLS number..." onfocus="this.value=''" onfocus="(document.propSearch.KeyField[0].value == true)"
onload="this.value='Enter MLS #...'" size="25" maxlength="20" type="text">
</p>
<p>
<input name="KeyField" value="City" type="radio">
Search by City
<input name="City" id="City" class="small" value="Enter City..." onfocus="this.value=''"
onfocus="(document.propSearch.KeyField[1].value == true)"
onload="this.value='Enter City...'" size="25" maxlength="15" type="text">
</p>



<p>
<input name="Submit" value="Submit" type="submit">

</p>
</center>
</form>

Twey
04-04-2006, 12:21 PM
<input name="ListingID" id="ListingID" class="small" value="Enter MLS number..." onfocus="this.value=''" onfocus="(document.propSearch.KeyField[0].value == true)"
onload="this.value='Enter MLS #...'" size="25" maxlength="20" type="text">I don't think input elements have an onload event; you certainly can't specify the same event twice. Also, you're using a comparison operator instead of an assignment operator to perform an assignment.
<input name="ListingID" id="ListingID" class="small" value="Enter MLS number..." onfocus="this.value=''" onfocus="(;document.propSearch.KeyField[0].value =checked = true)"
onload="this.value='Enter MLS #...'" size="25" maxlength="20" type="text">Remove the bits in red, add the bits in green.

abskure
04-10-2006, 04:58 PM
That worked thanks!