Buy Now
Sign in

Init input filed value with a data in datapath

ladyj , May 14 at 08:10
I wrote a plugin which load datapath with data I need to use to init input fields in Chronoforms 5.
It works if I use custom code and I insert HTML code like this:
<div class="form-group gcore-form-row" id="form-row-azienda">
&nbsp; <label&nbsp;for="azienda" class="control-label gcore-label-left">Azienda</label>
&nbsp; <div class="gcore-input gcore-display-table" id="fin-azienda">
&nbsp; &nbsp; <input name="field_name"&nbsp;id="field_name" value="<?php echo (isset($form->data['profile']) ? $form->data['profile']['field_name']:'');?>"&nbsp;placeholder="" maxlength="150" size="50" class="validate[&#039;required&#039;] form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="" type="text" />
&nbsp; </div>
The drawback is that my customer still wants to user designer function. Is there the possibility to init chronoforms 5 fileds with data in datapath and continue using form designer?
Thanks in advance
Hi ladyj,
Use a Custom Code action before the HTML (Render form) action and you can set a form value there:
​$form->data['field_name'] = ''; ​
​if ( isset($form->data['profile']) ) {​
​ $form->data['field_name'] = $form->data['profile']['field_name'];​
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much