View Full Version : Sev's Popup Calendar - Help Echoing Variable

01-09-2010, 04:53 PM
1) Script Title:
Sev's Popup Calendar

2) Script URL (on DD):

3) Describe problem:
Easy question hopefully, I'm just not as familiar as I should be...

I have an HTML form set up with Sev's Popup Calendar. The drop down works great, and the user's input is successfully placed into a field called "Date" as mm/dd/yyyy. No problems there.

What I'd like to do is figure out how to have the appropriate day of the week then echo to a readonly form field called "Day". I've got the form field set up using [ input type="text" name="Day" readonly="readonly" ] but have no idea how to get the day of the week to show up there.

Sev's script does have options where it will output the whole date with the day of the week, but I can only figure out how to get it into the "Date" field linked to the calendar, as one big variable.

Any help would be appreciated.

J :)

01-09-2010, 05:36 PM
That calendar (though rated for IE and Opera) appears to only work in IE. Before we go into detail on your question, I'd want to be sure that it's OK with you that the calendar only works in that one browser. Is it?

This one looks like (for cross browser compatibility) a better choice:


However, all of the calendar scripts on DD are old. You might do better with a more recent one from somewhere else.

01-09-2010, 07:52 PM
Gotcha... I'm looking for at least IE and FF compatible, but as many as possible would be great. I'll check out the link you sent and see what options it gives.

Is there a general way to take a date produced from a calendar like that and have it generate the appropriate day of the week, then transfer it to the other field?


01-09-2010, 09:00 PM
In a way yes. You can find the spot in the script where it creates a Date object that holds the date chosen, or a place where you can create a Date object from the text representation of the date chosen, then one may use the getDay() method to extract a number 0 through 6 from that Date object, 0 being Sunday and 6 being Saturday. On the basis of that value you may populate your readonly field. Fairly simple really. But the best spot to do it would naturally depend upon which script one was using. Some calendar scripts (none of those on DD as far as I know) may even already provide for such a value and/or its text equivalent to be retrieved via a special callback or other syntax.