Forums

CF5: tcpdf with different layout depending on the value of a field

sanma 30 Nov, 2018
As a title I ask if and how it is possible to use different layouts of tcpdf depending on the value of a field. Field that also guides the following fields. Sorry if perhaps it can be trivial but I have to merge two forms with different layouts in the same form with outputs on different tcpdf.
Thank you in advance.
GreyHead 30 Nov, 2018
Hi sanma,

Yes I think so but you would need to build the content (or parts of it) using a PHP action before the TCPDF action, save the content as a form variable and then include that in the TCPDF. Or if there are major differences you could use an Event Switcher and two different TCPDF actions.

Bob
sanma 30 Nov, 2018
The two pdf are completely different and have different fields in their input. I'd like to try using the event switcher commanded by the first dropdown list of the form. It's possible? If you could you give me a simple example?
Thank you very much
sanma 30 Nov, 2018
I tried a small example to understand how it works, with a dropdown list called dropdown1 with values Yes and No and the submit button.
In the event switcher I put the following code:

<? Php
if ($ form-> data ['dropdown1'] == 'Yes') {
return 'Yes';
} else {
return 'No';
}
?>

In Yes, I put a "display message" field, in no another "display message".

It does not show me any message .....

🙄
GreyHead 01 Dec, 2018
Hi sanma,

The code looks OK - there are some extra spaces but they may have been added in copying and posting to the forum here.

Please drag a Debugger action into the On Submit event after your event switcher, then submit the form and post the debug - including the 'dummy emails' results here.

Bob
sanma 03 Dec, 2018
Hi GreyHead.

Excuse me but also the debugger does not give any results. I do something wrong but I do not know what. 😶


My form is designed like this:
In Designer


In Setup



I don't see any message coming from the fields "Display Message" and any message from the debugger.
GreyHead 03 Dec, 2018
Hi sanma,

Please post a link to the form so we can take a quick look.

Bob
sanma 03 Dec, 2018
Unfortunately, the form is on an intranet that is not accessible from the outside. I delete the form and create it again, let's see if I can understand what happens.
Is there an example that I can follow step by step?
healyhatman 03 Dec, 2018
Sanma were your dropdown values ACTUALLY "Yes"/"No" or were they just the LABELS? I think you'll find your values will be either yes/no or more likely 1/0
sanma 04 Dec, 2018
Hi All,
healyhatman hit the problem....

In php I passed as data yes / no and not 1/0 .🙄

I could understand it myself!!!!!

If the dropdown1 cases are more than 2 can I use the case in the event switcher php?
Can you give me an example?

Thank you again
GreyHead 04 Dec, 2018
Hi sanma,

You can use the Event Switcher with more than two events with no prbolem.

Bob
This topic is locked and no more replies can be posted.