Solved

Anyone...Search Results via href link?

Posted on 2012-12-23
3
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
jmdl1983 earned 500 total points
ID: 38717089
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
ID: 38730703
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
ID: 38732260
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JQuery Syntax... 4 58
jQuery parseHTML 6 87
dynamic created check uncheck boxes 6 54
How to calculate height of a text using jquery 3 57
I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
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 how to dynamically set the form action using jQuery.
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)

738 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