Solved

Anyone...Search Results via href link?

Posted on 2012-12-23
3
264 Views
Last Modified: 2012-12-31
Hi I have a Business Catalyst site and found this code here to do what I want to achieve http://www.atlantawebdesignga.com/_blog/Adobe_Business_Catalyst_Developer/post/Use_a_Link_to_Submit_A_Web_App_Search_Results_Page_in_Adobe_Business_Catalyst/:

<script type="text/javascript">
   jQuery(document).ready(function(){
   var theCategory = '{ module_url,category}' ;
   if (theCategory) {
      jQuery('form.webapp option:contains("' + theCategory + '")').attr('selected', 'selected');
      jQuery("form.webapp").submit();
  }
});
</script>

Open in new window



My link is formated as follows:
http://mywebsite.businesscatalyst.com/blog-search-results.html?category=Baubles

Looks just what I need to do, link to search results page with category pre selected . Auto submit the form and have results on the page for the user.
Great and it works but it keeps refreshing/bouncing on the page. Can anyone see a way to stop it submiting more than once?
Help apprectaied.

p.s Merry Christams to you all.

Regards
Lee
0
Comment
Question by:boxhedge
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
jmdl1983 earned 500 total points
Comment Utility
If the jQuery is causing the loop, then change your jQuery such as:

<script type="text/javascript">
   jQuery(document).ready(function(){
   var theCategory = '{ module_url,category}' ;
   if (theCategory) {
      jQuery('form.webapp option:contains("' + theCategory + '")').attr('selected', 'selected');
      jQuery("form.webapp").submit();
      var theCategory = null;
  }
});
</script>

Open in new window


if it is the page code auto looping when it sees a category in the URL, then simply append the HREF URL to have something such as "&u=1" on the end of it, and only have it auto-submit if request("u")="1", that way it will not be passed to results page.
0
 

Author Comment

by:boxhedge
Comment Utility
Cheers, Doesn't seems to work, do i have to append the jquery you had in your answers?...anyone else know how to get around this?
0
 

Author Comment

by:boxhedge
Comment Utility
It does, my mistake. As does my own code but issue was the placement of it.
I was putting it in a sidewide js file where the value { module_url,category} couldn't be parsed. As soon as I placed it in a single page it worked.

Thanks anyway.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now