Jump to content

set date type form-field helper


Recommended Posts

Hello,

     I am using the new form-field helpers in the front office in part of my checkout steps. Version 1.7.3.0. I have found that I can add these by creating arrays that I pass to smarty.

$this->context->smarty->assign('fflexpiration',array(
        'name' => 'fflexpiration',
        'type' => 'date',
        'required' => 1,
        'label' => 'FFL Expiration',
        'value' => $this->getFFLExpiration(),
        'availableValues' => [],
        'maxLength' => null,
        'errors' => [],
        'constraints' => null
    )

Then in my template I can call 

{form_field field=$fflexpiration}

Everything looks good. The form appears, I can enter a date in the date picker, and I can grab the information afterwards to save in the db. However, I can not get any data to load into the datepicker. For example if the values already exist and they should appear in the date picker when the page loads, the date picker is always empty. Is there a trick to preset the date picker value the same way you can use the 'value' variable to set text types ?

Edited by vm0824
addl info (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...