Buy Now
Sign in

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

sanma , November 30 2018
S
sanma
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
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
sanma
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
S
sanma
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
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
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
sanma
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
designer.png
In Setup
setup.png
I don't see any message coming from the fields "Display Message" and any message from the debugger.
Attachments
designer.png
designer.png
(20.56 KiB)
68 Downloads/Views
setup.png
setup.png
(47.34 KiB)
67 Downloads/Views
GreyHead
Hi sanma,
Please post a link to the form so we can take a quick look.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
S
sanma
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
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
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

DON'T COPY+PASTE FROM THE FORUMS! It adds hidden code-breaking format characters!
S
sanma
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
Hi sanma,
You can use the Event Switcher with more than two events with no prbolem.
Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much