Buy Now
Sign in

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

sanma , November 30 2018, 12:29
S
sanma 13
November 30 2018, 12:29 #381910
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 64
November 30 2018, 13:42 #381914
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 13
November 30 2018, 14:16 #381915
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 13
November 30 2018, 14:57 #381916
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 64
December 01 2018, 11:59 #381928
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 13
December 03 2018, 11:35 #381978
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)
137 Downloads/Views
setup.png
setup.png
(47.34 KiB)
139 Downloads/Views
GreyHead 64
December 03 2018, 14:34 #381979
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 13
December 03 2018, 14:48 #381980
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 7
December 03 2018, 21:21 #381988
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 DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
S
sanma 13
December 04 2018, 10:13 #382002
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 64
December 04 2018, 10:21 #382003
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