View Full Version : javascript and radio buttons converturl

02-05-2010, 11:20 PM
I'm hoping someone can tell me where I'm going wrong with the following. Everything seems to work just fine until I added the ability to specify a filetype. This form gives the user a text box to enter their search terms, a hidden field with some boolean elements for the search, a radio button to choose pdf, doc, or txt and a submit button. If I remove the filetype option from the html and scripting it works just fine. So, this has to be my problem. I'm getting undefined errors. I'm very new with javascript, so this is probably something simple that I'm missing. Thanks in advance for any help or suggestions!

<form action="http://www.bing.com/search"
onsubmit="this.q.value += (this.url.value + ' ' + this.city.value + this.filetype1.value); return true;">
<input type="hidden" name="q"
value="music classic " />
<table class="style1">
<td> </td>

<td class="style2">
<label><input name="url" type="text" style="width: 176px" /></label></td>
<td class="style3"><label><select name="city" class="c1">
<option value="Dallas" selected="selected">Dallas</option>
<option value="">Nationwide</option>
<option value="Atlanta">Atlanta</option>
<option value="Austin">Austin</option>
<option value="Boston">Boston</option>

<td><input type="submit" name="search" value="Search" /></td>
<input id="radio" checked="checked" name="filetype1" type="radio" value="filetype:doc"
class="style6" /><span class="style6">.doc
<input id="radio1" name="filetype1" type="radio" value="filetype:pdf"
class="style6" /><span class="style6">.pdf
<input id="radio2" name="filetype1" type="radio" value="filetype:txt"
class="style6" /><span class="style6">.txt

<script type="text/javascript">
function converturl() {
frm = document.forms[0];
return frm.f.value + + +
frm.fullurl.value +
frm.url.value + '+' +
frm.city[frm.city.selectedIndex].value + '+' +
frm.filetype1[frm.filetype1.selectedRadio].value + '+'+