Chronforms V6 $form->data

Access form data and include custom CSS in ChronoForms V6.

Overview

In ChronoForms V6, the method to access form data has changed from CF5, and users need guidance on applying custom CSS.
To access form data, use $this->data or the shortcode {data:field_name} within double quotes in PHP code. To include custom CSS, add the CSS code directly into a Custom CSS element or use a Custom HTML element to link or import external CSS files.

Ni NickOg 26 May, 2017
Just taken my first look at CF6 & CC6. Impressive but different to CF5/CC5 but looks like CF6 & CC6 are much more alike. It will take me a while. 😲

Two quick questions
[list=]Do I need to pay these to validate? OK if I do - just need to know.[/list]
[list=]In CF6 what is the equivalent of $form->data? Something in $this - but what 😶[/list]

I suspect from a quick look at the forum that $form->data approach in pho code is either obsolete or not necessary.

Thanks

Nick
Max_admin Max_admin 26 May, 2017
Answer
Hi Nick,

Same validation keys should work fine!

$form->data is now $this->data, but there is also a shortcode syntax which you can use, like {data:field_name}, I'm trying to write a manual soon.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Ni NickOg 26 May, 2017
1 Likes
Thanks Max - manual in your spare time???🙄😀. I look forward to it - in the meantime I think the demos will give me a kick start wit that piece of information.

Regards

Nick
st stijnst 26 May, 2017
Hi

thanks for the tip, this helped me a lot as well.

{data:fieldname} or {var:fieldname} seems to return an error message if used as a variable inside a custom php code block:
$result={data:input};


using it inside a double quoted string however, seems to work fine:
print("you typed: {data:input_number}");

So I guess the php code is executed first, and the {data:...} blocks are filled in afterwards. The following statement will display the content of the 'input_number' form field:
print(":{data:"."input_number}");


Also, returning data out of a custom php code block seems to be not working. instead of:
return $result;

and using it as {var:result} or {data:myVar} later on in a confirmation email, I had to set it as
$this->data['result']

in my custom php code in order to use it.
Ni NickOg 26 May, 2017
Great stuff Max - well on the way.

Thanks

Nick
Ni NickOg 27 May, 2017
Some questions now pop up no doubt. I can't find an example for including CSS. I have found where to define some CSS and have included this

form#history-list{
background-color:aqua !important;
font-size:10px !important;
width:90% !important;
}
and named it
historyCSS


Three questions
[list=]How do i reference that on pages/events?[/list]
[list=]How can I include reference to a CSS file or files? Using the CSS @import?[/list]
[list=]Can one use a php require command to include css files - similar to CF5??[/list]

Nick
Max_admin Max_admin 27 May, 2017
Hi Nick,

This is a Chronoforms or Connectivity question ? in Connectivity you need to call the view or function, but in Chronoforms its enough to place the code in a custom CSS element.

You can include a CSS file using a Custom HTML element, you may also require a CSS file that way since the HTML element supports PHP.

@stijnst, please check this FAQ:
https://www.chronoengine.com/faqs/74-chronoforms6/5289-variable-shortcodes.html

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Ni NickOg 27 May, 2017
1 Likes
Hi Max

Sorry - it was Connectivity related. Thanks for that info - and those FAQs.
Making more progress.

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