Redirect to print in new window

So what do you want to do with the form, save it and redirect to list or leave it in "editing" state?
 
So what do you want to do with the form, save it and redirect to list or leave it in "editing" state?
by clicking Save, I want it to save and redirect to the list, and open a new window to print the previous data
 
Last edited:
If you set "Content Redirect" under the "Module/Content plug-in redirect options" tab to "Popup" or "New Page" does it work as you want it?
 
If you set "Content Redirect" under the "Module/Content plug-in redirect options" tab to "Popup" or "New Page" does it work as you want it?
No, set to both popup and new window does not work. Only the same window works.
Instead of the above code for the print page, I also tried with a random page, and other links, but it only works in the same window.
 
No, set to both popup and new window does not work. Only the same window works.
Instead of the above code for the print page, I also tried with a random page, and other links, but it only works in the same window.

What about adding target="_blank" to the end of the URL?
 
You can't redirect to opening a new tab/window in PHP, and so a "target" attribute can't be applied. But it can be done with Javascript.

So, what you can do: do not use the Fabrik form redirect plugin, but a form PHP plugin instead. There you echo/return some Javascript (within <script>...</script> tags) to open a URL in a new tab/window.
If you're not familiar with JS: Google around, there's tons about it online.
 
Like @lousyfool said, it has to be done with javascript. And your case seems tricky. I personally haven't been able to reliably run javascript in form PHP-plugin, so one way would be to open a popup from list_xx.js when list is loaded after redirect.

But the tricky part is not to open the popup every time this list is loaded. So I would try something like:

1) In your form redirect plugin add something like "&myrow={rowid}" to your redirect url.
2) Add extra element to your list like "popup_shown" and set it to "0" in form PHP-plugin for a current row.
3) Now after redirect to list, you can get the rowid from url querystring in list_xx.js
4) With user ajax (call to a function in user_ajax.php) you check whether the "popup_shown" element is "0" and if yes, open the popup in ajax.done function.
5) And in ajax.done function you could have another ajax call to update the "popup_shown" element to "1".

This is not tested and there might be better ways to do it, but this is what came to my mind atm.
 
Last edited:
Thanks everyone for the answers.
I've actually tried many avenues before and after writing this post, but they all failed for me.




You can't redirect to opening a new tab/window in PHP, and so a "target" attribute can't be applied. But it can be done with Javascript.

So, what you can do: do not use the Fabrik form redirect plugin, but a form PHP plugin instead. There you echo/return some Javascript (within <script>...</script> tags) to open a URL in a new tab/window.
If you're not familiar with JS: Google around, there's tons about it online.


Yes in fact I had already tried to do it via php and js, and not redirects, but I tried many js codes without finding one that worked for me.
I had already considered this route



Like @lousyfool said, it has to be done with javascript. And your case seems tricky. I personally haven't been able to reliably run javascript in form PHP-plugin, so one way would be to open a popup from list_xx.js when list is loaded after redirect.

But the tricky part is not to open the popup every time this list is loaded. So I would try something like:

1) In your form redirect plugin add something like "&myrow={rowid}" to your redirect url.
2) Add extra element to your list like "popup_shown" and set it to "0" in form PHP-plugin for a current row.
3) Now after redirect to list, you can get the rowid from url querystring in list_xx.js
4) With user ajax (call to a function in user_ajax.php) you check whether the "popup_shown" element is "0" and if yes, open the popup in ajax.done function.
5) And in ajax.done function you could have another ajax call to update the "popup_shown" element to "1".

This is not tested and there might be better ways to do it, but this is what came to my mind atm.


This may seem like a working solution.
I could try to reproduce your passages.
But some points I did not understand.
it is not my mother tongue and therefore I have a hard time understanding what to do.

Meanwhile, I'm thinking that perhaps the simplest solution is:
redirect to the page with the redirect, and then print them from.
Then to go back insert a button with a link to the list.
It almost seems like the simplest solution.
But the problem would be to hide the button only from the print. as in the pdf with css I hide it without problems.
while in the print view no as you could not hide it in the print, otherwise it is not even seen in the form.
Do you think the button or a link to go back is more feasible?
 
Definitely just redirecting to printable page would be the easiest way.

You could try hiding the buttons in your template custom css file like:
CSS:
@media print {
  #YourButtonID {
   display: none;
  }
}
Check your button IDs with browser inspect tool.
 
Last edited:
Definitely just redirecting to printable page would be the easiest way.

You could try hiding the buttons in your template custom css file like:
CSS:
@media print {
  #YourButtonID {
   display: none;
  }
}
Check your button IDs with browser inspect tool.

The best and easiest solution was effective.
And so I did so I set the redirection to the print page and I inserted a button in the introduction of the module to make it visible at the top.
I inserted an html button to the link of the list, and hidden the field from the press with the css code.
And the result is optimal.
It was even more so if I could put the "close" button in line together with the predefined "print", "pdf", "email" buttons.
Do you think there is a way to have that "close" button in line with the others? It would also be cleaner aesthetically.
I checked some code but couldn't find where to edit.
If you have an idea for me I would be grateful

 
Last edited:
Probably easiest to align the buttons would be customized details template. Add your own button in default_buttons.php and necessary styling (css) to your details template custom.css or custom_css.php file.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top