Skip to main content

Search and Top Navigation

#3113 closed bug (fixed)

Opened July 18, 2008 08:08PM UTC

Closed July 23, 2008 05:23PM UTC

Last modified May 16, 2010 03:23PM UTC

datepicker error for escaped special character in element id

Reported by: gdoe6545@yahoo.it Owned by: grabanski
Priority: major Milestone:
Component: ui.datepicker Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:
Description

I'm using jQuery in combination with JavaServer Faces and the element IDs generated by JSF have the form "[form name]:[id]" e.g.

<input id="searchForm:outboundDate" type="text" name="outboundDate" />

These selectros were catered for in jQuery 1.1.3 by enabling the use of \\\\ to escape special characters.

Escape Selectors: A frequently requested feature you can now select elements by ID (or other selector) that uses a special character, for example this will find the div that has the ID of “foo.bar”: $("div#foo\\\\.bar")

But when I use this form of selector with the datepicker I get the error "fn is not a funtion".

$("#searchForm\\\\:outboundDate").datepicker({

showOn: "both",

buttonImage: "#{request.contextPath}/images/icon/cal-popup.gif",

buttonImageOnly: true

});

Attachments (0)
Change History (4)

Changed July 23, 2008 05:23PM UTC by kbwood comment:1

resolution: → fixed
status: newclosed

Fixed. Now handles ids with embedded ':' or '.'.

The 'fn is not a function' error indicates that either jQuery or the plugin did not load properly.

Changed September 06, 2008 09:50PM UTC by simone_b comment:2

I'm still experiencing this issue in 1.6 b with jQuery 1.2.6 on an element with a dot in the id.

The calendar slides down correctly, but when I do any action like selecting a day or changing month I get a "elem is undefined" somewhere in jquery script file.

Here's the markup:

<script type="text/javascript">

$(function() {

$("#Message\\\\.DeliveryDate").datepicker();

});

</script>

<input id="Message.DeliveryDate" name="Message.DeliveryDate" type="text" value="01/01/0001 00:00:00" />

Changed September 06, 2008 09:59PM UTC by simone_b comment:3

Sorry, here's the right formatting.

<script type="text/javascript">
$(function() {
  $("#Message\\\\.DeliveryDate").datepicker();
});
</script>

<input id="Message.DeliveryDate" name="Message.DeliveryDate" type="text" />

Changed May 14, 2009 07:45PM UTC by kazet comment:4

I'm experiencing this issue with Datepicker 1.7.1 and jQuery 1.3.2 on an element with an ' / ' in ID.The calendar slides down correctly, but when I do any action like selecting a day or changing month I get a "Missing instance data for this datepicker" line 1279 in the jquery script.

Example

<script type="text/javascript">
$(function() {
  $("#attribute\\\\/name").datepicker();
});
</script>

<input id="attribute/name" name="attribute/name" type="text" />