jQuery: The Write Less, Do More JavaScript Library

Datepicker not registering a select event from the mouse

View: New views
5 Messages — Rating Filter:   Alert me  

Datepicker not registering a select event from the mouse

by Steve Holmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm appending a new form to my page using a $.post.  After I have
appended the data, I am binding the datepicker to all the dates in the
new form.  The datepicker shows up with the image and when I click the
image the calendar pops up.  However, when I use the mouse to select a
day nothing happens.  I added a select: function() with an alert to
the datepicker and the alert never shows up.

The odd thing is that all the keyboard shortcuts work.  When I hit the
enter key the alert pops up and the date is added to the input.

I'm using this exact same function in other places and it works
perfectly.  Please advise.
Thanks in Advance,
Steve

$("input#add-phase-button").live("click", function(event) {
      var phaseForm = $(this).closest("form#add-phase-form");
      var phaseUrl = $(phaseForm).attr('action');
      jQuery.post(phaseUrl, function(data) {
        var phasesContainer = jQuery("div#phases-container").append
(data);
        var newPhase = phasesContainer.find('#save-phase-form');
        bindDates(newPhase);
      });
      event.preventDefault();
    });

function bindDates(containerElement) {
      var dateInputs = containerElement.find('input.date-picker');
      dateInputs.datepicker({
        showOn: 'button',
        buttonImage: '${createLinkTo(dir:'images',file:
'calendar_icon.gif')}',
        buttonImageOnly: true,
        onSelect: function(dateText, inst) { alert('Selected!'); }
      });
    }

--

You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery-ui@....
To unsubscribe from this group, send email to jquery-ui+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.



Re: Datepicker not registering a select event from the mouse

by Steve Holmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

bump

On Nov 5, 8:51 am, Steve Holmes <iamstevehol...@...> wrote:

> I'm appending a new form to my page using a $.post.  After I have
> appended the data, I am binding the datepicker to all the dates in the
> new form.  The datepicker shows up with the image and when I click the
> image the calendar pops up.  However, when I use the mouse to select a
> day nothing happens.  I added a select: function() with an alert to
> the datepicker and the alert never shows up.
>
> The odd thing is that all the keyboard shortcuts work.  When I hit the
> enter key the alert pops up and the date is added to the input.
>
> I'm using this exact same function in other places and it works
> perfectly.  Please advise.
> Thanks in Advance,
> Steve
>
> $("input#add-phase-button").live("click", function(event) {
>       var phaseForm = $(this).closest("form#add-phase-form");
>       var phaseUrl = $(phaseForm).attr('action');
>       jQuery.post(phaseUrl, function(data) {
>         var phasesContainer = jQuery("div#phases-container").append
> (data);
>         var newPhase = phasesContainer.find('#save-phase-form');
>         bindDates(newPhase);
>       });
>       event.preventDefault();
>     });
>
> function bindDates(containerElement) {
>       var dateInputs = containerElement.find('input.date-picker');
>       dateInputs.datepicker({
>         showOn: 'button',
>         buttonImage: '${createLinkTo(dir:'images',file:
> 'calendar_icon.gif')}',
>         buttonImageOnly: true,
>         onSelect: function(dateText, inst) { alert('Selected!'); }
>       });
>     }

--

You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery-ui@....
To unsubscribe from this group, send email to jquery-ui+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.



Re: Datepicker not registering a select event from the mouse

by Fontzter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there any chance of duplicate ids in the DOM after you add the
content?

On Nov 6, 11:26 am, Steve Holmes <iamstevehol...@...> wrote:

> bump
>
> On Nov 5, 8:51 am, Steve Holmes <iamstevehol...@...> wrote:
>
> > I'm appending a new form to my page using a $.post.  After I have
> > appended the data, I am binding the datepicker to all the dates in the
> > new form.  The datepicker shows up with the image and when I click the
> > image the calendar pops up.  However, when I use the mouse to select a
> > day nothing happens.  I added a select: function() with an alert to
> > the datepicker and the alert never shows up.
>
> > The odd thing is that all the keyboard shortcuts work.  When I hit the
> > enter key the alert pops up and the date is added to the input.
>
> > I'm using this exact same function in other places and it works
> > perfectly.  Please advise.
> > Thanks in Advance,
> > Steve
>
> > $("input#add-phase-button").live("click", function(event) {
> >       var phaseForm = $(this).closest("form#add-phase-form");
> >       var phaseUrl = $(phaseForm).attr('action');
> >       jQuery.post(phaseUrl, function(data) {
> >         var phasesContainer = jQuery("div#phases-container").append
> > (data);
> >         var newPhase = phasesContainer.find('#save-phase-form');
> >         bindDates(newPhase);
> >       });
> >       event.preventDefault();
> >     });
>
> > function bindDates(containerElement) {
> >       var dateInputs = containerElement.find('input.date-picker');
> >       dateInputs.datepicker({
> >         showOn: 'button',
> >         buttonImage: '${createLinkTo(dir:'images',file:
> > 'calendar_icon.gif')}',
> >         buttonImageOnly: true,
> >         onSelect: function(dateText, inst) { alert('Selected!'); }
> >       });
> >     }

--

You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery-ui@....
To unsubscribe from this group, send email to jquery-ui+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.



Re: Datepicker not registering a select event from the mouse

by Steve Holmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes but not for any of the elements referenced in code...

On Nov 6, 9:37 am, Fontzter <dmfo...@...> wrote:

> Is there any chance of duplicate ids in the DOM after you add the
> content?
>
> On Nov 6, 11:26 am, Steve Holmes <iamstevehol...@...> wrote:
>
> > bump
>
> > On Nov 5, 8:51 am, Steve Holmes <iamstevehol...@...> wrote:
>
> > > I'm appending a new form to my page using a $.post.  After I have
> > > appended the data, I am binding the datepicker to all the dates in the
> > > new form.  The datepicker shows up with the image and when I click the
> > > image the calendar pops up.  However, when I use the mouse to select a
> > > day nothing happens.  I added a select: function() with an alert to
> > > the datepicker and the alert never shows up.
>
> > > The odd thing is that all the keyboard shortcuts work.  When I hit the
> > > enter key the alert pops up and the date is added to the input.
>
> > > I'm using this exact same function in other places and it works
> > > perfectly.  Please advise.
> > > Thanks in Advance,
> > > Steve
>
> > > $("input#add-phase-button").live("click", function(event) {
> > >       var phaseForm = $(this).closest("form#add-phase-form");
> > >       var phaseUrl = $(phaseForm).attr('action');
> > >       jQuery.post(phaseUrl, function(data) {
> > >         var phasesContainer = jQuery("div#phases-container").append
> > > (data);
> > >         var newPhase = phasesContainer.find('#save-phase-form');
> > >         bindDates(newPhase);
> > >       });
> > >       event.preventDefault();
> > >     });
>
> > > function bindDates(containerElement) {
> > >       var dateInputs = containerElement.find('input.date-picker');
> > >       dateInputs.datepicker({
> > >         showOn: 'button',
> > >         buttonImage: '${createLinkTo(dir:'images',file:
> > > 'calendar_icon.gif')}',
> > >         buttonImageOnly: true,
> > >         onSelect: function(dateText, inst) { alert('Selected!'); }
> > >       });
> > >     }

--

You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery-ui@....
To unsubscribe from this group, send email to jquery-ui+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.



Re: Datepicker not registering a select event from the mouse

by Steve Holmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Wow I think you hit the nail on the head.  All my inputs had duplicate
ids due to multiple forms....When I changed this one it fixed it.
Thanks!
-Steve

On Nov 6, 9:37 am, Fontzter <dmfo...@...> wrote:

> Is there any chance of duplicate ids in the DOM after you add the
> content?
>
> On Nov 6, 11:26 am, Steve Holmes <iamstevehol...@...> wrote:
>
> > bump
>
> > On Nov 5, 8:51 am, Steve Holmes <iamstevehol...@...> wrote:
>
> > > I'm appending a new form to my page using a $.post.  After I have
> > > appended the data, I am binding the datepicker to all the dates in the
> > > new form.  The datepicker shows up with the image and when I click the
> > > image the calendar pops up.  However, when I use the mouse to select a
> > > day nothing happens.  I added a select: function() with an alert to
> > > the datepicker and the alert never shows up.
>
> > > The odd thing is that all the keyboard shortcuts work.  When I hit the
> > > enter key the alert pops up and the date is added to the input.
>
> > > I'm using this exact same function in other places and it works
> > > perfectly.  Please advise.
> > > Thanks in Advance,
> > > Steve
>
> > > $("input#add-phase-button").live("click", function(event) {
> > >       var phaseForm = $(this).closest("form#add-phase-form");
> > >       var phaseUrl = $(phaseForm).attr('action');
> > >       jQuery.post(phaseUrl, function(data) {
> > >         var phasesContainer = jQuery("div#phases-container").append
> > > (data);
> > >         var newPhase = phasesContainer.find('#save-phase-form');
> > >         bindDates(newPhase);
> > >       });
> > >       event.preventDefault();
> > >     });
>
> > > function bindDates(containerElement) {
> > >       var dateInputs = containerElement.find('input.date-picker');
> > >       dateInputs.datepicker({
> > >         showOn: 'button',
> > >         buttonImage: '${createLinkTo(dir:'images',file:
> > > 'calendar_icon.gif')}',
> > >         buttonImageOnly: true,
> > >         onSelect: function(dateText, inst) { alert('Selected!'); }
> > >       });
> > >     }

--

You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to jquery-ui@....
To unsubscribe from this group, send email to jquery-ui+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.