PDA

View Full Version : Radio button does not change value?



Ant469
12-29-2010, 12:20 PM
Hello everybody! :)

I've inherited a code for my website although it doesn't seem to be working correctly.

For example:

http://www.3pointproperty.co.uk/landlords.htm

The search function on the left hand side should change from
"100 PCM" to "50,000" when the radio button 'For Sale' is selected, although it does not. Does anybody know how I can fix this problem?

Thank you all in advance

Nile
12-30-2010, 02:08 AM
Give them ids and use document.getElementById,

Ant469
12-30-2010, 08:48 AM
Thanks Nile, that would make sense!

I am a javascript newbie though; is there any chance you could give me a specific example of what do/insert? Thanks in advance :)


<!--XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-->
<table class="rtcolgray" width="770" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="185" align="center" valign="top" class="stylebg2">
<h4>Property Search</h4>
<form class="c6" id="form1" method="post" name="form1" action="http://www.viewpoint.net.uk/property.asp?action=submitsearchform" target="_self"><input type="hidden" name="agentid" value="1666" id="agentid"> <input type="hidden" name="psc_branchid" value="" id="psc_branchid"> <input type="hidden" name="psc_isforsale" value="" id="psc_isforsale"> <input type="hidden" name="psc_istolet" value="1" id="psc_istolet"> <input type="hidden" name="psc_orderby" value="4" id="psc_orderby"> <input type="hidden" name="psc_rtid" value="5" id="psc_rtid"> <input type="hidden" name="public" value="1" id="public">
<table class="search" border="0">

<tr>
<td>
<table class="table" border="0" width="130">
<tr>
<td class="c3" align="left"></td>
<td align="left">Rent<input type="radio" value="2" checked id="psc_marketing" class="clear" name="psc_marketing" onclick="javascript:fnMarketing(this.value);"> For sale<input type="radio" value="1" id="psc_marketing" class="clear" name="psc_marketing" onclick="javascript:fnMarketing(this.value);"></td>
</tr>
</table>
<table class="search c5" id="price_low" width="130" align="center">
<tr>
<td width="130" align="left">Price from:</td>
</tr>
<tr>

<td align="left"><select id="psc_pricelow" class="clear c4" name="psc_pricelow">
<option value="50000">50,000</option>
<option value="60000">60,000</option>
<option value="70000">70,000</option>
<option value="80000">80,000</option>
<option value="90000">90,000</option>
<option value="100000">100,000</option>
<option value="110000">110,000</option>
<option value="120000">120,000</option>

<option value="130000">130,000</option>
<option value="140000">140,000</option>
<option value="150000">150,000</option>
<option value="160000">160,000</option>
<option value="170000">170,000</option>
<option value="180000">180,000</option>
<option value="190000">190,000</option>
<option value="200000">200,000</option>
<option value="210000">210,000</option>

<option value="220000">220,000</option>
<option value="230000">230,000</option>
<option value="240000">240,000</option>
<option value="250000">250,000</option>
<option value="260000">260,000</option>
<option value="270000">270,000</option>
<option value="280000">280,000</option>
<option value="290000">290,000</option>
<option value="300000">300,000</option>

<option value="325000">325,000</option>
<option value="350000">350,000</option>
<option value="400000">400,000</option>
<option value="450000">450,000</option>
<option value="475000">475,000</option>
<option value="500000">500,000</option>
<option value="550000">550,000</option>
<option value="600000">600,000</option>
<option value="650000">650,000</option>

<option value="700000">700,000</option>
<option value="800000">800,000</option>
<option value="900000">900,000</option>
<option value="1000000">1,000,000</option>
<option value="1500000">1,500,000</option>
<option value="2000000">2,000,000</option>
<option value="3000000">3,000,000</option>
</select></td>
</tr>
</table>

<table class="search c5" id="price_high" width="130" align="center">
<tr>
<td width="130" align="left">Price to:</td>
</tr>
<tr>
<td align="left"><select id="psc_pricehigh" class="clear c4" name="psc_pricehigh">
<option value="50000">50,000</option>
<option value="60000">60,000</option>
<option value="70000">70,000</option>
<option value="80000">80,000</option>
<option value="90000">90,000</option>

<option value="100000">100,000</option>
<option value="110000">110,000</option>
<option value="120000">120,000</option>
<option value="130000">130,000</option>
<option value="140000">140,000</option>
<option value="150000">150,000</option>
<option value="160000">160,000</option>
<option value="170000">170,000</option>
<option value="180000">180,000</option>

<option value="190000">190,000</option>
<option value="200000">200,000</option>
<option value="210000">210,000</option>
<option value="220000">220,000</option>
<option value="230000">230,000</option>
<option value="240000">240,000</option>
<option value="250000">250,000</option>
<option value="260000">260,000</option>
<option value="270000">270,000</option>

<option value="280000">280,000</option>
<option value="290000">290,000</option>
<option value="300000">300,000</option>
<option value="325000">325,000</option>
<option value="350000">350,000</option>
<option value="400000">400,000</option>
<option value="450000">450,000</option>
<option value="475000">475,000</option>
<option value="500000">500,000</option>

<option value="550000">550,000</option>
<option value="600000">600,000</option>
<option value="650000">650,000</option>
<option value="700000">700,000</option>
<option value="800000">800,000</option>
<option value="900000">900,000</option>
<option value="1000000">1,000,000</option>
<option value="1500000">1,500,000</option>
<option value="2000000">2,000,000</option>

<option value="3000000">3,000,000</option>
</select></td>
</tr>
</table>
<table class="search" id="rent_low" width="130" align="center">
<tr>
<td width="130" align="left">Price from:</td>
</tr>
<tr>
<td align="left"><select id="psc_rentlow" class="clear c4" name="psc_rentlow">
<option value="100">100 pcm</option>
<option value="200">200 pcm</option>
<option value="300">300 pcm</option>

<option value="400">400 pcm</option>
<option value="500">500 pcm</option>
<option value="600">600 pcm</option>
<option value="700">700 pcm</option>
<option value="800">800 pcm</option>
<option value="900">900 pcm</option>
<option value="1000">1000pcm</option>
<option value="1250">1250 pcm</option>
<option value="1500">1500 pcm</option>

<option value="1750">1750 pcm</option>
<option value="2000">2000 pcm</option>
<option value="2500">2500 pcm</option>
<option value="3000">3000 pcm</option>
<option value="3500">3500 pcm</option>
<option value="4000">4000 pcm</option>
<option value="4500">4500 pcm</option>
<option value="5000">5000 pcm</option>
<option value="6000">6000 pcm</option>

<option value="7000">7000 pcm</option>
<option value="8000">8000 pcm</option>
<option value="9000">9000 pcm</option>
<option value="10000">10,000 pcm</option>
<option value="15000">15,000 pcm</option>
<option value="20000">20,000 pcm</option>
<option value="25000">25,000 pcm</option>
<option value="30000">30,000 pcm</option>
</select></td>

</tr>
</table>
<table class="search" id="rent_high" width="130" align="center">
<tr>
<td width="130" align="left">Price to:</td>
</tr>
<tr>
<td align="left"><select id="psc_renthigh" class="clear c4" name="psc_renthigh">
<option value="100">100 pcm</option>
<option value="200">200 pcm</option>
<option value="300">300 pcm</option>
<option value="400">400 pcm</option>

<option value="500">500 pcm</option>
<option value="600">600 pcm</option>
<option value="700">700 pcm</option>
<option value="800">800 pcm</option>
<option value="900">900 pcm</option>
<option value="1000">1000pcm</option>
<option value="1250">1250 pcm</option>
<option value="1500">1500 pcm</option>
<option value="1750">1750 pcm</option>

<option value="2000">2000 pcm</option>
<option value="2500">2500 pcm</option>
<option value="3000">3000 pcm</option>
<option value="3500">3500 pcm</option>
<option value="4000">4000 pcm</option>
<option value="4500">4500 pcm</option>
<option value="5000">5000 pcm</option>
<option value="6000">6000 pcm</option>
<option value="7000">7000 pcm</option>

<option value="8000">8000 pcm</option>
<option value="9000">9000 pcm</option>
<option value="10000">10,000 pcm</option>
<option value="15000">15,000 pcm</option>
<option value="20000">20,000 pcm</option>
<option value="25000">25,000 pcm</option>
<option value="30000">30,000 pcm</option>
</select></td>
</tr>
</table>

<!--table class="table" width=140 class="property_type" align=center><tr><td width=140 align=left>
Property Type:</td></tr><tr><td align=left><SELECT id=psc_propertytype class=clear
name=psc_propertytype style="width:140px"> <OPTION selected><OPTION value=2>Houses</OPTION>
<OPTION value=8>Flats / Apartments</OPTION> <OPTION value=6>Bungalows</OPTION>
<OPTION value=9>Character Property</OPTION> <OPTION value=14>Land</OPTION>
<OPTION value=12>Guest House / Hotel</OPTION> <OPTION value=7>Mobile / Park
Homes</OPTION> <OPTION value=13>Commercial Property</OPTION> <OPTION
value=10>Retirement Property</OPTION> <OPTION value=11>House / Flat
Share</OPTION> <OPTION value=15>Garage / Parking</OPTION></SELECT> </td></tr></table-->
<table class="search" width="130" align="center">
<tr>
<td width="130" align="left">Bedrooms:</td>
</tr>
<tr>
<td align="left"><select id="psc_minbeds" class="clear c4" name="psc_minbeds">
<option selected value="0">Studio</option>
<option value="1">1 Bedroom</option>
<option value="2">2 Bedrooms</option>
<option value="3">3 Bedrooms</option>
<option value="4">4 Bedrooms</option>

<option value="5">5 Bedrooms</option>
<option value="6">6 Bedrooms</option>
<option value="7">7 Bedrooms</option>
</select></td>
</tr>
</table>
<br>
<table width="130">
<tr>
<td align="left"><input id="cmdSubmit" value="Search Now" type="submit" name="submit_button"></td>
</tr>

Nile
12-30-2010, 09:05 AM
For example


<script type="text/javascript">
var _ = function (el) {
return document.getElementById(el);
}
var check = function () {
if (_('a').checked) {
_('sel_a').style.display = "block";
_('sel_z').style.display = "none";
} else if (_('z').checked) {
_('sel_z').style.display = "block";
_('sel_a').style.display = "none";
}
}
</script>
A<input type="radio" name="letters" value="A" id="a" onclick="check()" checked /> or Z <input type="radio" name="letters" value="Z" id="z" onclick="check()"/><br />
<select id="sel_a">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<select id="sel_z" style="display: none">
<option>Z</option>
<option>Y</option>
<option>X</option>
</select>

Ant469
12-31-2010, 12:38 PM
Problem solved. Thanks for your help Nile