Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker: client side getDate/setDate throw JS error #4523

Closed
georgwolf opened this Issue Feb 11, 2019 · 0 comments

Comments

Projects
None yet
3 participants
@georgwolf
Copy link
Contributor

georgwolf commented Feb 11, 2019

1) Environment

2) Expected behavior

Client side JavaScript methods getDate() / setDate(...) retrieve/set date of DatePicker component

3) Actual behavior

JS error trown when calling getDate/setDate methods on a DatePicker:
Error: no such method 'getDate' for datePicker widget instance
Error: no such method 'setDate' for datePicker widget instance

4) Steps to reproduce

Assign widgetVar to a datePicker and then try calling setDate(null) and getDate() on it

5) Sample XHTML

<p:datePicker widgetVar="datePicker" />
<p:button onclick="PF('datePicker').setDate(null);return false;" value="Clear DatePicker" />
<p:button onclick="alert(PF('datePicker').getDate());return false;" value="GetDate" />

6) Cause:

setDate/getDate are implemented via _setOption in 0-datepicker.js, but it seems like jQuery is expecting individual setDate/getDate functions to be present.

_setOption: function (key, value) {
if (key === 'setDate') {
this.value = this.parseValue(value);
/* set changes */
this.panel.get(0).innerHTML = this.renderPanelElements();
this.inputfield.val(this.value);
}
else if (key === 'getDate') {
return this.value;
}
},

@tandraschko tandraschko added the defect label Feb 11, 2019

@mertsincan mertsincan self-assigned this Feb 11, 2019

@mertsincan mertsincan added the 6.2.17 label Feb 11, 2019

@mertsincan mertsincan added this to the 7.0 milestone Feb 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.