Asterodeia
Asterodeia

Reputation: 73

Primefaces 5.2 calendar is undefined

I'm upgrading my version of Primefaces from 3.0.1 to 5.2. I'm now with myFaces 2.2.8 and Primefaces 5.2. This upgrade broke my primefaces calendar and I cannot figure what happened :

I'm using : widgetVar="calendar" in my p:calendar but I cannot access the javascript variable calendar any more.

Here is my sample page :

    <h:body>
    <p:calendar popupIconOnly="true"
                showOn="button"
                id="validityCalendar"
                locale="fr" 
                navigator="true"
                disabledWeekends="true" 
                style="padding-left:5px; padding-right:5px;"
                widgetVar="calendar" size="10" />
   <script type="text/javascript">
   $(function() {
    calendar.jqEl.datepicker("option", {maxDate : "11/07/2016", onChangeMonthYear : onChangeMonthYear});
   });
   </script>
</h:body>

And I get this error :

ReferenceError: calendar is not defined

I do not include another jquery or jquery-ui than the one of Primefaces. The popupIconOnly does not work either but this is another topic...

Upvotes: 4

Views: 637

Answers (1)

Mathieu Castets
Mathieu Castets

Reputation: 6040

ReferenceError: calendar is not defined

From PrimeFaces 4.0 you need to use PF('widgetVar') instead of widgetVar, i.e. PF('calendar').

The popupIconOnly does not work either but this is another topic...

popupIconOnly attribute has been removed from PrimeFaces 5.0

Upvotes: 4

Related Questions