How do I get a field to show the current date? I searched the forum but didn't find an answer.
Thank you!
Thank you!
HI LIkestuff,
Add a Custom Code action in the form On Load event with code like this
And add an input in the Designer tab with the name today and readonly=readonly in the Extra Params box.
Bob
Add a Custom Code action in the form On Load event with code like this
<?php
$form->data['today'] = date('d-m-Y');
?>
And add an input in the Designer tab with the name today and readonly=readonly in the Extra Params box.
Bob
Sorry I think I missed something😟
I am using a text box named "current-date".
I add the code below in a Custom Code action on the form On Load event.
The date is not showing. What did I miss please?
I am using a text box named "current-date".
I add the code below in a Custom Code action on the form On Load event.
<?php
$form->data['current-date'] = date('d-m-Y');
?>
The date is not showing. What did I miss please?
Hi LikeStuff,
Is the Custom Code action before the HTML (Render Form) action? In not, please move it up, otherwise this looks OK.
Bob
Is the Custom Code action before the HTML (Render Form) action? In not, please move it up, otherwise this looks OK.
Bob
Hi Likestuff,
Most of the time ChronoForms runs the actions in the order they are shown in the events. So the HTML (render form) action renders the form HTML, including the values, with the info available at that point.
Bob
Most of the time ChronoForms runs the actions in the order they are shown in the events. So the HTML (render form) action renders the form HTML, including the values, with the info available at that point.
Bob
Hello.
I'm using chronoforms 6 and it seems custom code is not working. I put the code before "display section", but fields are not filled. Is there some change in the new version? Please see attached image.
I'm using chronoforms 6 and it seems custom code is not working. I put the code before "display section", but fields are not filled. Is there some change in the new version? Please see attached image.
Hi javerlo,
In v6 you should use $this->data instead of $form->data, and the way to do it actually is to use this shortcode in the "value" field instead of using custom code:
Best regards,
Max
In v6 you should use $this->data instead of $form->data, and the way to do it actually is to use this shortcode in the "value" field instead of using custom code:
{date:Y-m-d}
Best regards,
Max
This topic is locked and no more replies can be posted.