Isaac Bosca Isaac Bosca -4 years ago 149
Javascript Question

Create INSPINIA Theme Form fields using Javascript

I'm trying to generate form fields dinamically with INSPINIA appearence, specifically INSPINIA datepicker. You can check this fields on: http://wrapbootstrap.com/preview/WB0R5L90S

First of all, I have at least one form generated with Symfony using the following code on the Type class.

{{ form_widget(form.date_from, { 'attr': {'class': 'datepicker form-control'}}) }}


This works fine, and generate the following html:



<input type="text" required="required" class="datepicker form-control" value="01-01-2017" aria-required="true">





Then, when I try to copy the entire form using JS and put the same code (cloning the form), the inspinia datepicker doesn't appears, only appears the standard text form.

It is posible to generate this datepicker using JavaScript?

Answer Source

Finally I fixed the problem, seems that Inspinia datepicker is based on jQuery datepicker, so.. I only need to call datepicker() function to get the code working as I expected.

More info about jQuery datepicker here: https://jqueryui.com/datepicker/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download