Different PDF based on Element Value

sunnyjey

Active Member
Please help me understand to generate different PDF output based on the value of Selected Element.

I have copied and made different custom templates under folder components/com_fabrik/views/details/tmpl for e.g.. Template1, Template2, Template3 etc.

I have Field Element which auto-populates option like Template1 based on some calculations.

My question, how to redirect the form after submission to particular Template based on value Element selection. I know, I have to install redirect plugin and append element value in jump Field

index.php?option=com_fabrik&view=form&formid=X&format=PDF&rowid={rowid}

What should be correct redirect URL and placement of Element ?
 

Attachments

  • cfxbuu.png
    cfxbuu.png
    17.3 KB · Views: 44
You would probably need to use multiple redirect plugins, with a Condition set on each one so only one runs, and each one add the appropriate &layout=whatever to the URL.

So if you have an element 'yourtable___foo' and want to redirect to layout "template2" if the value of foo is "two" ...

return '{yourtable___foo}' == 'two';

... in the condition, with a jump URL that has &layout=template2 on the URL.

Alternatively, if the value of your element is part of the template name, you might be able to just use one redirect, like ...

index.php?option=com_fabrik&view=details&formid=123&rowid={rowid}&layout=template{yourtable___foo}

-- hugh
 
How do I attach the generated custom PDF to the Email Form Plugin.

When I enable PDF attachment in Email form Plugin it attaches PDF of Form view. I want to attach custom template PDF generated by using above method. What should be the correct URL and where should I place it Email Plugin ?
 
The email plugin will always generate a PDF of the form it is running on.

Are you saying you want it to generate a PDF of the form you are redirecting to?

-- hugh
 
Yes.

I have three customize template for Form (form_tmpl), Detail(detail_tmpl) and PDF (pdf_tmpl).

I would like to generate PDF of the form with CSS design from (pdf_tmpl)
 
Your initial question didn't mention email, it talked about redirecting to a view with different layouts.

As-is, there is no way to alter which template the email will attach. It always uses whatever you have set as the PDF template for that form.

-- hugh
 
Oh.. I can understand.

Is there any way to attach a button in list / detail view where User can download the generated PDF ( using default PDF template of that form).

Let me explain in detail. As you know by this time, I have two forms FormA and FormB connected with the common field InvoiceID where the visitor submit details in FormA are autopopulated in FormB through InvoiceID. The staff then add more data through additional field elements in FormB. It then generates PDF Report of FormB through redirect.

I'm looking for the way to attach the generated PDF report from FormB to the FormA LIST with button Element (tablename1___download_report) & using lookup field {tablename1__invoiceid}.
 
Last edited:
OK, I'm still confused.

I'm looking for the way to attach the generated PDF report from FormB to the FormA LIST with button Element (tablename1___download_report) & using lookup field {tablename1__invoiceid}.

So you want a button / link on the list for form A which generates a PDF of the related form B?

-- hugh
 
You could use the 'link' plugin, to build the PDF view link using placeholders. If you need to use something other than the primary key as the "rowid", use the 'usekey' query string, like &usekey=other_id&rowid={yourtable___other_id}, which will tell Fabrik to look up the row using 'other_id'.

-- hugh
 
As per your suggestion, I have added Link plugin to the form1 List.

I guess, I have to place following URL in the link field. I know this url is incorrect, as it is not generating anything. Please guide.

Code:
return '<a href="http://www.mydomain.com/index.php?option=com_fabrik&view=details&formid=5&usekey=invoiceid&rowid={mytable___invoiceid}&format=pdf"</a>';


downloadreport.png

@Hugh, if possible can you extract few hours to help in customizing these forms as a Paid work. I had sent your Personal message regarding same on Private conversation, but still waiting for the reply.
 
Just ...

Code:
http://www.mydomain.com/index.php?o...id&rowid={mytable___invoiceid_raw}&format=pdf

... should do it, no quotes, no 'return', no href, etc. Just the link you want to use.

If that doesn't work, point me at the list so I can take a look.

-- hugh
 
Tried. But didn't work. Maybe I've entered the wrong syntax.

Please log in and do the needful.

I am trying to add download button in List ID 4 from ListId 5 PDF rows.
 
OK, you are trying to use an element from List 5, in the link on list 4 ...

&usekey=reports___patientid&rowid={xxx_reports___patientid}

This list is xxx_cases, so when rendering rows, you only have data available from xxx_cases. You need whatever field on xxx_cases that is the patientid that links to the xxx_reports row. And I don't see one.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top