Web tier: servlets, JSP, Web frameworks: Pop-up calendar - any 'best practices' to do this?
- Posted by: Joe Attardi
- Posted on: September 23 2004 10:13 EDT
Another beginner question, I guess. In my application I have several date fields, and when the user clicks on one I have a pop-up window open with a calendar for them to select the date.
Finding the element is easy enough, just use opener.getElementById('...'), the problem was keeping track of which field to update. The solution I ended up using was to have a request parameter named 'dateField' that held the name of the field. The other parameters were, of course, the month and year to display.
These went to a Struts action which set these as request attributes, and then I wrote a custom tag to generate the HTML for the calendar itself.
The problem is, any time changing to a new month, or whatever, I have to manually add on the "&dateField=" + dateField; and while this is a simple example it could get more complicated.
Thanks very much..
- Pop-up calendar - any 'best practices' to do this? by Chris Schalk on September 23 2004 15:57 EDT
- Pop-up calendar - any 'best practices' to do this? by Marina Prikaschikova on September 28 2004 07:28 EDT
I haven't seen a best practices for this exactly, but I've definitely seen a lot of different types of implementations..
To more comprehensive UI frameworks such as Oracle's UIX, or soon to be called "ADF Faces" which is a custom JSF UI framework which happens to have a datepicker component.
In your case, it sounds like you've solved your problems mostly.. You might want to share your example to the Java community.. Who knows maybe someone else could improve on it..
See for example Calendar taglib in Coldtags suite:
It shows how to return data to the main form