Please read and follow the COMMON ISSUES first!
Always add your version information in every new post! Thank you!

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. David
  2. F2C Search front-end
  3. Monday, April 03 2017, 03:04 PM
  4.  Subscribe via email
Hi All

When using the F2C Search module is it possible to load the results in a new window? So when the user clicks the "show results" button a new page/tab opens and displays the results?

I have tried adding target="_blank" to the form but that doesn't work.

My reason for this is that (for various reasons) I have the search module showing in an iframe on another website and I want the user to be redirected to the main website when they search.

Thanks
Responses (4)
F2C webmaster Accepted Answer Pending Moderation
Hi David,

Interesting question. Since it's an onclick event I believe we have to add the new window to the JS event. For this I have to ask Julien what the best place is and if it's possible to do within a module override. Will pass the question on.

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  1. more than a month ago
  2. F2C Search front-end
  3. # 1
David Accepted Answer Pending Moderation
Hi Patrick

Thanks for your reply, I look forward to seeing what Julien thinks.
  1. more than a month ago
  2. F2C Search front-end
  3. # 2
Julien Accepted Answer Pending Moderation
Hi David,

Showing the results is done by the javascript function F2CSearchGetResultsXX, where XX is the Id of your module.
The results are now shown by a redirect using the javascript statement location.href = ......

In this place you have to put a window.open method with the same url.

Where the function code is defined, depends on your template. It is either in one of the following files:

  • <website root>/modules/mod_form2contentsearch/tmpl/default.php
  • <website root>/modules/mod_form2contentsearch/tmpl/modern.php
  • <website root>/modules/mod_form2contentsearch/tmpl/uikit.php


When you change any of those files, I would suggest doing it by means of an override.

best,
Julien
  1. more than a month ago
  2. F2C Search front-end
  3. # 3
David Accepted Answer Pending Moderation
Hi Julien, thanks for your response.

I have updated the module so that location.href reads as:


location.href = window.open('<?php echo JURI::base(); ?>index.php?option=com_form2contentsearch&task=search.display&pb=1&moduleid=<?php echo $moduleId; ?>&searchformid=<?php echo $searchFormId; ?>&results='+F2CSearchResultCount<?php echo $moduleId; ?>+'&' + filterUrl<?php echo ($forcedItemId) ? ' + \'&Itemid=\' + ' . $forcedItemId : ''; ?>;);


This works but has the side effect of the parent window redirecting to an error page with url https://mydomain.com/[object Window]

I'll keep playing with this and see what I can do.
  1. more than a month ago
  2. F2C Search front-end
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.