Pass a variable to Chronoform using Article Layout menu type

andrea74 29 Jun, 2013
Hello, I created a form using ChronoForm component and I need to send a variable value to the form page through URL (for example ?color=red)
I would pass the variable using a menu item type "Article Layout" (of course, it does not allow to change manually the link) adding the code ?color=red
Is there an alternative solution to avoid to use an "External link" item type to do it?
Thank you.
GreyHead 30 Jun, 2013
Hi Andreaj,

Using the URL I think that you have to use a full URL as you suggest.

There is a version of the Plug-in in the forums that has been modified to accept parameters if that helps.

You could also rely on the Article ID and look up the value in ChronoForms from an array or a DB table.

Bob
andrea74 30 Jun, 2013
Thank you Bob: where can I find the plug-in you're talking about?
Regards.
andrea74 08 Jul, 2013
Dear Bob, thank you for the link.
I worked around this plugin all weekend without success: I still need a solution to pass a variable to my Chronoform using menu item type "Article Layout".
You were talking about the possibility to rely on the Article ID and look up the value inside Chronoform: would you be so kind to help me with this solution?
Thank you in advance.
andrea74 08 Jul, 2013
Hello, I found a solution that might be useful to other users.
I put the following code directly in a Chronoform text/hidden box:

<?php 
 $currentMenuId = JSite::getMenu()->getActive()->id ;
 if ($currentMenuId == "1") echo 'Value1'; 
?>


Using conditional code, can be used for multiple variables.
There are probably more "elegant solutions", but for my purposes it is sufficient.
This topic is locked and no more replies can be posted.