Loading ...
Sorry, an error occurred while loading the content.

Re: how to form submit to new page, on calendar date click? - Yahoo UI

Expand Messages
  • catlincolin
    ... know? ... code ... type= hidden ... First off, thanks for a wonderful gift! A not too big not too small integratable system. I m using this with PHP. I
    Message 1 of 2 , Jun 5, 2006
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "catlincolin" <colin@...>
      > Hi!
      > The code included below looks correct, but doesn't seem to be
      > working for me. It seems to submit...looks like it's reloading the
      > page, but never actually leaves the page. Something I don't
      > What's up? Any pointers?
      > Thought this would be easy, but apparently not. My current test
      > below. Thx! -C
      > ...
      > YAHOO.namespace("example.calendar");
      > function init() {
      > YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar2up
      > ("YAHOO.example.calendar.cal1","container1");
      > YAHOO.example.calendar.cal1.title = "Select a desired date:";
      > YAHOO.example.calendar.cal1.setChildFunction("onSelect",setDate1);
      > YAHOO.example.calendar.cal1.render();
      > function showCalendar1() {
      > YAHOO.example.calendar.cal1.outerContainer.style.display='block';
      > }
      > function setDate1() {
      > var date1 = YAHOO.example.calendar.cal1.getSelectedDates()[0];
      > document.addEventGo.add_month.value = date1.getMonth();
      > document.addEventGo.add_day.value = date1.getDate()-1;
      > document.addEventGo.add_year.value = date1.getYear();
      > YAHOO.example.calendar.cal1.hide();
      > document.addGo.submit();
      > }
      > YAHOO.util.Event.addListener(window, "load", init);
      > ...
      > <FORM name="addGo" action="index.php" method="post"><input
      > name="month" type="hidden" value=""><input name="day"
      > value=""><input name="year" type="hidden" value=""></FORM>
      > ...

      First off, thanks for a wonderful gift! A not too big not too small
      integratable system. I'm using this with PHP.

      I didn't get any replys, but on closer inspection of the Calendar.js
      code, the above problem looks to be caused because the YUI code for
      the "onSelect" event is called in many cases before other code has a
      chance to run/finish in the same code stack. Causing what could be
      termed as sort of race condition. So the "onSelect" event actually
      gets ignored quite a lot depending on circumstances. Could this be
      called at the end instead so it works correctly and as not to race
      and conflict? I admit I don't know.

      If you stick entirely on one Ajaxie page for everything you may
      never encounter this. So this may not effect you as your system may
      not worry about the order so much as it just getting done.

      But for ordered events, and once the system gets more popular,
      possibly not so good? I think I ran into this because I'm
      integrating it with external php pages and a flow that uses both.

      In case it's helpful here's what I did:

      I hacked it to bypass the onselect, by overriding this:

      YAHOO.widget.Calendar_Core.prototype.renderCellDefault = function
      (workingDate, cell)

      including it in my web page javascript so it now calls a local
      function rather than ... link.href="javascript:void(null);";

      This works for multiple calendars as well, as long as you hack it
      before your render it.


    Your message has been successfully submitted and would be delivered to recipients shortly.