Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Form builder

edited June 2017 in Modules
Hi. I'm building a form using form_builder class and I need this date picker field. I use the same code as is given in the example here:

No date picker appear :(

public function index()
// load Form_builder;

// load the custom form fields

// create fields
$fields['linked'] = array('type' => 'linked', 'linked_to' => array('name' => 'url_title'));
$fields['datetime'] = array('type' => 'datetime', 'first_day' => 2, 'date_format' => 'dd-mm-yyyy', 'min_date' => '01-01-2012', 'max_date' => '31-12-2012');
$fields['test_image'] = array('upload' => TRUE);
$fields['number'] = array('type' => 'number', 'represents' => 'int|smallint|mediumint|bigint', 'negative' => TRUE, 'decimal' => TRUE);
$fields['currency'] = array('type' => 'currency', 'negative' => TRUE, 'decimal' => '.');
$fields['phone'] = array('type' => 'phone', 'required' => TRUE);
$fields['file_example'] = array('type' => 'file', 'overwrite' => TRUE, 'display_overwrite' => TRUE, 'multiple' => FALSE);
$fields['state'] = array('type' => 'state');
$fields['list_items'] = array('type' => 'wysiwyg', 'editor' => 'markitup');
$fields['date_example'] = array('type' => 'date', 'first_day' => 2, 'date_format' => 'd-m-Y', 'min_date' => '01-01-2012', 'max_date' => '31-12-2012');

// set the fields

// render the page
$vars['form'] = $this->form_builder->render();
$this->load->view('test', $vars);


View file:

" rel="stylesheet" type="text/css" media="all" />




  • edited 8:23AM
    Well, in view file I load jQuery from here and bootstrap.min.js in header part and then in body this $form variable.
    What's wrong with it?
  • edited 8:23AM
    It sounds like you are building this form for the front-end of your forms. There is a fuel/modules/fuel/assets/js/fuel/custom_fields.js that has the initialization function of fuel.fields.datetime_field that will also need to be loaded. You can also try adding this line:
  • edited 8:23AM
    Thanks for support and for the fast answer! Well, yeah, I do include this line, it's right after form_builder initialization. I've been testing with wysiwyg field type and the editor is not loaded either. So I guess the problem is with the js initialization? There are no js errors on the console. I guess I'll take a closer look tomorrow
  • edited 8:23AM
    I got it. In my case bootstrap-datepicker component was not included. After I included it (">) the problem was solved. I think there's some amount of css needs to be added but that's a little pain.
    I was confident all needed components are loaded automatically.
Sign In or Register to comment.