Solved

Anyone...Search Results via href link?

Posted on 2012-12-23
3
265 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery Data table pagination not working ? 12 40
jQuery Canlendar click function 5 42
Angular - filter - one works but other doesn't 13 32
Bootstap Icons 3 44
DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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…

920 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

16 Experts available now in Live!

Get 1:1 Help Now