Hello Everyone and thanks for your help in advance. I an new to JQuery and am working on an application that uses autocomplete. What I would like to do is be able to change the search criteria forthe page by using radio box (see the page at :
http://ernestbarbacollection.com/search4.aspx). Currently, my scriptpoints to a URL like:
Obviosuly, appending another search criteria based on the selected radio button is the way to get this
done. However, being inexperienced in JQuery and javascript, I am unsure how to do this. Any help would be greatly appreciated.
Sorry to forget to mark it. Yes it mostly worked and you did answer the I asked, however, it did raise another in that how would you do it within a web user control?
You could actually imploy a very similar technique but instead of hard coding the strings put them in data- elements. I forked the JS fiddle to demonstrate:
The key is the "data-"attribute and the $(this) selector. You can add a generic selector like I did in the is fiddle and the using the data method pull of custom data points from the HTML element.
kmcnet
Participant
1090 Points
652 Posts
Changing Search for Autocomplete widget
Jul 28, 2012 09:18 PM|LINK
Hello Everyone and thanks for your help in advance. I an new to JQuery and am working on an application that uses autocomplete. What I would like to do is be able to change the search criteria forthe page by using radio box (see the page at : http://ernestbarbacollection.com/search4.aspx). Currently, my scriptpoints to a URL like:
url: "http://www.ernestbarbacollection.com/RecordSearch2.aspx?keywordStartsWith=" + request.term,
Obviosuly, appending another search criteria based on the selected radio button is the way to get this done. However, being inexperienced in JQuery and javascript, I am unsure how to do this. Any help would be greatly appreciated.
aterra
Participant
910 Points
162 Posts
Re: Changing Search for Autocomplete widget
Jul 29, 2012 01:05 AM|LINK
Check out this quick JS fiddle I wrote. I think it does what you need it to do.
http://jsfiddle.net/vbZ89/1/
aterra
Participant
910 Points
162 Posts
Re: Changing Search for Autocomplete widget
Aug 01, 2012 09:51 PM|LINK
Did this work for you? if so please mark as the answer.
Thanks
kmcnet
Participant
1090 Points
652 Posts
Re: Changing Search for Autocomplete widget
Aug 02, 2012 06:52 PM|LINK
Sorry to forget to mark it. Yes it mostly worked and you did answer the I asked, however, it did raise another in that how would you do it within a web user control?
aterra
Participant
910 Points
162 Posts
Re: Changing Search for Autocomplete widget
Aug 02, 2012 11:13 PM|LINK
You could actually imploy a very similar technique but instead of hard coding the strings put them in data- elements. I forked the JS fiddle to demonstrate:
http://jsfiddle.net/45PCP/1/
kmcnet
Participant
1090 Points
652 Posts
Re: Changing Search for Autocomplete widget
Aug 03, 2012 06:21 PM|LINK
Thanks again for the help. I'm new to JQuery and not really following the code.
I tried:
$("input[name=SearchCriteria]:radio").change(function () { if ($("input[id$='rbArtist']").attr("checked")) {
searchCategory = "&Category=Artist"; }
to access the boxes in a web user control, but it didn't work. Not sure why.
Thanks again.
aterra
Participant
910 Points
162 Posts
Re: Changing Search for Autocomplete widget
Aug 03, 2012 06:45 PM|LINK