I've got a problem using the datepicker widget.
In my Struts 1 / JSP application I've got a form with a datepicker which is selected via its class and not its id field because it is otherwise used.
- <script src="../../../webserver/jquery/jquery-ui.min.js" type="text/javascript"></script>
- <link rel="stylesheet" href="../../../webserver/jquery/jquery-ui.css" type="text/css"/>
- <script src="../../../webserver/jquery/jquery.ui.datepicker-de.js"></script>
- <script src="../../../webserver/jquery/jquery.ui.datepicker-fr.js"></script>
- <script src="../../../webserver/jquery/jquery.ui.datepicker-en.js"></script>
- <script>
- $(function() {
- $(".datepicker").datepicker({
- showOn: "both",
- dateFormat: "dd.mm.yy",
- firstDay: 1,
- buttonImage: "../../../webserver/images/redesign/kalendar_up.gif"
- });
- $.datepicker.setDefaults($.datepicker.regional['<%=((java.util.Locale)session.getAttribute(org.apache.struts.action.Action.LOCALE_KEY)).getLanguage()%>']);
}); - </script>
If I click on the date input field the calendar popup opens. But if I click on a date or the previous or next buttons in the popup I get the error "Uncaught exception: Missing instance data for this datepicker" and nothing happens. The field isn't populated with the selected date and the month isn't switched either by clicking on previous / next. This is what is being rendered:
- <input type="text" name="gueltigVon" maxlength="16" size="10" value="" onblur="clearHighLightFields(this)" onfocus="showHighLightFields(this)" class="datepicker hasDatepicker">
As you can see an additional style class was added to my datepicker. Is that the reason jQuery can't find my datepicker? Why doesn't the datepicker widget work properly? Thanks for any hint!
The Chrome console shows some additional info. Maybe it is some kind of stack trace:
- t.extend._getInst
- t.extend._selectDay
- e.selectDay
- f.event.handle
- i.handle.k