Variable switching from Php to Javascript in php plugin list

bonghetti

Member
I used the Php List plugin to mark the selected rows as soldered. It works correctly (I create a payment id, update the date and indicate in a field that it is paid). Now at the same time I have to generate a PDF of the receipt, and I came up with an idea that partially worked. I added the javascript code provided by the plugin to open a detail of a list view with that payment and it automatically downloads the PDF (there is a layout problem because it is as if the PDF was generated without the Ajax view... sorry for my explanation). But in the meantime I have another problem: I can't pass the contents of the variable that created the payment id between the php code and the javascript code). here is the js code:
var $paymentId = details_56.formElements.get('a_iscrizioni_incontro_repeat___Pagamento').getValue();
var baseUrl = "/site/index.php";
var queryParams = "option=com_fabrik&task=details.view&formid=56&listid=56&rowid=" + paymentId + "&format=pdf";
var urlToOpen = baseUrl + "?" + queryParams;
window.open(urlToOpen, '_blank');
 
when I select them with php code I make sure that all the selected rows share a single Payment id, so I would then like to open a link that contains this payment id that I assigned to the selected group. I hope I was able to explain myself correctly. Thanks always Troester
 
Hmm, the JS code is run before the php code. you can abort the php by returning FALSE in JS code, e.g. do
return confirm('Do you really want to do this?') ;

You could use $statusMsg in the php code to include the link to ...format=pdf
 
Hmm, the JS code is run before the php code. you can abort the php by returning FALSE in JS code, e.g. do
return confirm('Do you really want to do this?') ;

You could use $statusMsg in the php code to include the link to ...format=pdf

I was convinced that the JS code was executed later, perhaps because visually the form is inserted later and therefore I had understood it that way.
At this point inserting all the code into php would make more sense, but I don't think I can get the automatic download of the pdf as happened with windows.open in javascript
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top