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

Re: [ydn-javascript] Calender & Date format [Was: Re: Calendar & form posting ]

Expand Messages
  • Cecil Vermule
    Since you are using a hidden to hold the value, you either need to use that as a Date object on the server side, or in your setDate() function you need to
    Message 1 of 6 , Apr 17 8:13 AM
    • 0 Attachment
      Since you are using a hidden to hold the value, you either need to use that as a Date object on the server side, or in your setDate() function you need to parse it out yourself.
       
      Example:

         function setDate()
         {
          var lDate = sCalendar.getSelectedDates()[0];

          selDate.value= lDate.getFullYear() + "-" + lDate.getMonth() + "-" + lDate.getDate();

          sCalendar.hide();
         }



       
      On 4/17/06, samuel_feynman <samuel_feynman@...> wrote:
      Hi Marcus,
      Your suggestion worked! THANK YOU!! Here's what I ended up with (in
      case any newbie in the future needs to do the same thing):

      <form action="/jobs/add" method="POST" name="form"
      onsubmit="this.the_date.value = cal1.getSelectedDates()">
      <input type="hidden" id="the_date" name="the_date" />
      <div id="cal1Container"></div>
      </form>

      Another Q - I didn't see anything in the docs about formatting the
      date. The date currently returns as "Wed Apr 19 2006 00:00:00 GMT-0400
      (Eastern Daylight Time)" and I'm wondering if there is a "format date"
      option to get it into "YYYY-MM-DD" format?

      All the best,
      Samuel

      --- In ydn-javascript@yahoogroups.com, Marcus Engene <ehsmeng@...> wrote:
      >
      > bjames722 wrote:
      > > Hi Marcus,
      > >
      > > Thanks for the quick reply. I tried the following to no avail -
      > > "the_date" is still an empty string on the server side :(
      > >
      > > <td><input type="hidden" id="the_date" name="the_date" />
      > > <div id="cal1Container"></div></td>
      > >
      > > <td><input name="click" type="submit" value="Add Job"
      > > onsubmit="document.getElementById('the_date').value =
      > > cal1.getSelectedDates ();" /></td>
      > > </form>
      > >
      > > Thanks,
      > > Samuel
      > >
      > Hi,
      >
      > tested it now; i got it to work if i listen to event onclick instead.
      > If you use onsubmit I suppose you must put it on the form tag instead.
      > And then "this" would work as expected too, I suppose.
      >
      > (Replying to list if someone else will get this problem)
      >
      > Best regards,
      > Marcus
      >








      Yahoo! Groups Links

      <*> To visit your group on the web, go to:
         http://groups.yahoo.com/group/ydn-javascript/

      <*> To unsubscribe from this group, send an email to:
         ydn-javascript-unsubscribe@yahoogroups.com

      <*> Your use of Yahoo! Groups is subject to:
         http://docs.yahoo.com/info/terms/




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