signalpoint / DrupalGap

An application development kit for Drupal websites.
https://www.drupalgap.org
GNU General Public License v2.0
232 stars 185 forks source link

Jquery Mobile Datepicker Widget #1024

Closed SegaWeb closed 5 years ago

SegaWeb commented 5 years ago

I'm trying to add a Datepicker Widget Jquery Mobile (http://demos.jquerymobile.com/1.4.5/datepicker/#ui-page-top).

But after adding in the index.html file or hook_install in my custom module and adding attributes 'data-role': 'date' (textfield), all the time I get an error "drupalgap_goto_generate_page_and_go - TypeError: Cannot read property '_defaults' of undefined"

What could be the reason? Thank!

signalpoint commented 5 years ago

@SegaWeb I used grep to look through all of the source code for DrupalGap 7 and jDrupal 7, neither of which has any code that tries to access a property called _defaults from an object. This sounds like a problem in your custom module's code, or a problem in the jQuery date picker.

SegaWeb commented 5 years ago

So I can not understand!

In custom module (in hook_form_alter) I I just added: form.elements['s_test'] = { type: 'textfield', id: drupalgap_form_get_element_id('my_new_elementsss', form_id), title: 'Date field', attributes: { 'data-role': 'date', 'data-inline': "false" } };

In index.html include js and css (as well as in the instructions) `

`
SegaWeb commented 5 years ago

Understood the problem. In addition to jquery.mobile.datepicker.js, you must first add jquery.ui.datepicker.js.