Monday, March 7, 2011

How to use a calendar to choose dates on web page?

I have an html page that contains startdate and enddate as user inputs. I need to let the user choose from a calendar for these inputs, instead of requiring the user to type the dates. Can you suggest anything to help?

From stackoverflow
  • Check this out - http://www.xaprb.com/blog/2005/09/29/javascript-date-chooser/

    By the way, you ought to be more clear and specific in asking your question.

  • I have an HTML page:

    StartDate: yyyy-mm-dd EndDate: yyyy-mm-dd

    Currenly these two fields are text fields.

    I would like to implement this using calender control where user can select any date from the calender.

    Vijay Dev : You should have edited your question.
    Jonathan Lonowski : Are you trying to find a calendar input (instead of textboxes)? Or, find a picker with format options (YYYY-MM-DD vs. MM/DD/YYYY)?
  • I think once you start needing this kind of controls, you should move to using javascript libraries.

    I recommend you jquery or YUI (you have more: prototype, mootools, etc...)

    Concretely for the calendar control, you can use YUI, they have a special js for this. Once you download YUI you can find it here: /yui/build/calendar-min.js and you have a very good example in the path: /yui/examples/calendar.

    The method you use to create it is: new YAHOO.widget.Calendar("cal","calendario", { LOCALE_WEEKDAYS:"1char", START_WEEKDAY: 1, mindate:"1/1/2008"});

    If you prefer jquery, you will find a calendar control here:

    http://ui.jquery.com/repository/tags/latest/demos/functional/#ui.datepicker

  • If you're on ASP.NET you could use this one; http://ra-ajax.org/samples/Ajax-Calendar.aspx

    I work for Ra-Ajax BTW...

0 comments:

Post a Comment