Setup: I have a RadioButtonList with two listitems (One Street, the other Schools). These define what type of search I want. I textbox with associated autocomplete. First you select which search to complete, and then start typing and the autocomplete will make suggestions. Autocomplete goes out to ashx webservice which pulls a list from the database.
I have tested the webserver and it works properly, so I'm thinking the problem is with my jQuery UI autocomplete...
HTML FORM ------------------------------------------
<div id="divSelectOn e" style="padding: 8px 3px 8px 3px; border-bottom:1px dotted #cccccc; background:#f9f 9f9;">
<span style="font-weight:bold; color:#369;">Se lect One:</span><br />
<asp:RadioButto nList ID="radSelect" runat="server" RepeatDirection ="Horizontal " class="tblSelec t">
<asp:ListItem Text=" Street, City, Zip or Subdivision" Value="Street" Selected="True" ></asp:ListItem>
<asp:ListItem Text=" School" Value="Schools" ></asp:ListItem>
</asp:RadioButton List>
<asp:TextBox ID="txtSearchSt ring" runat="server" Text="Enter Street, City, Zip or Subdivision" CssClass="txtSe archString" onFocus="txtSea rchStringSwitch ();" onBlur="txtSear chStringSwitch( );"></asp:TextBox>
</div>
JS ------------------------------------------------------
$(document).rea dy(function() {
// Autocomplete function for TextBox: txtSearchString
$("#ctl00_BodyC ontents_txtSear chString").auto complete({
minLength: 2,
source: ".../WebServices/jQAutocomplete. ashx?s=" + $('table.tblSel ect input:radio:che cked').val(),
select: function(event, ui) {
$("#ctl00_BodyC ontents_txtList ").val(ui.item. id);
alert(".../WebServices/jQAutocomplete. ashx?s=" + wtf);
}
});
// Toggle function for Select One: section
var $radSelect = $("table.tblSel ect input:radio");
$radSelect.clic k(function() {
var $radChecked = $('table.tblSel ect input:radio:che cked');
if ($radChecked.ne xt().text() == " School") {
$("#ctl00_BodyC ontents_txtSear chString").val( 'Enter School Name or District');
}
else {
$("#ctl00_BodyC ontents_txtSear chString").val( 'Enter Street, City, Zip or Subdivision');
}
});
});
No matter what I do it always passes s=Street as the querystring. Oddly though when a display the alert it has the correct URL in it. As I said before I know the webservice is working correctly, becuase I am using it in other places...
I have tested the webserver and it works properly, so I'm thinking the problem is with my jQuery UI autocomplete...
HTML FORM ------------------------------------------
<div id="divSelectOn e" style="padding: 8px 3px 8px 3px; border-bottom:1px dotted #cccccc; background:#f9f 9f9;">
<span style="font-weight:bold; color:#369;">Se lect One:</span><br />
<asp:RadioButto nList ID="radSelect" runat="server" RepeatDirection ="Horizontal " class="tblSelec t">
<asp:ListItem Text=" Street, City, Zip or Subdivision" Value="Street" Selected="True" ></asp:ListItem>
<asp:ListItem Text=" School" Value="Schools" ></asp:ListItem>
</asp:RadioButton List>
<asp:TextBox ID="txtSearchSt ring" runat="server" Text="Enter Street, City, Zip or Subdivision" CssClass="txtSe archString" onFocus="txtSea rchStringSwitch ();" onBlur="txtSear chStringSwitch( );"></asp:TextBox>
</div>
JS ------------------------------------------------------
$(document).rea dy(function() {
// Autocomplete function for TextBox: txtSearchString
$("#ctl00_BodyC ontents_txtSear chString").auto complete({
minLength: 2,
source: ".../WebServices/jQAutocomplete. ashx?s=" + $('table.tblSel ect input:radio:che cked').val(),
select: function(event, ui) {
$("#ctl00_BodyC ontents_txtList ").val(ui.item. id);
alert(".../WebServices/jQAutocomplete. ashx?s=" + wtf);
}
});
// Toggle function for Select One: section
var $radSelect = $("table.tblSel ect input:radio");
$radSelect.clic k(function() {
var $radChecked = $('table.tblSel ect input:radio:che cked');
if ($radChecked.ne xt().text() == " School") {
$("#ctl00_BodyC ontents_txtSear chString").val( 'Enter School Name or District');
}
else {
$("#ctl00_BodyC ontents_txtSear chString").val( 'Enter Street, City, Zip or Subdivision');
}
});
});
No matter what I do it always passes s=Street as the querystring. Oddly though when a display the alert it has the correct URL in it. As I said before I know the webservice is working correctly, becuase I am using it in other places...