Hi all,
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.
I didn't want a bunch of convoluted JavaScript code so I wrote a little JSP that just displays a calendar and has that in the popup. The only real problem I ran into was how to set the right value back in the opener window.
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.
Is there any sort of established best practices with JavaScript popups and keeping track of field names, etc?
Thanks very much..
Joe
Discussions
Web tier: servlets, JSP, Web frameworks: Pop-up calendar - any 'best practices' to do this?
-
Pop-up calendar - any 'best practices' to do this? (2 messages)
- Posted by: Joe Attardi
- Posted on: September 23 2004 10:13 EDT
Threaded Messages (2)
- 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
-
Pop-up calendar - any 'best practices' to do this?[ Go to top ]
- Posted by: Chris Schalk
- Posted on: September 23 2004 15:57 EDT
- in response to Joe Attardi
I haven't seen a best practices for this exactly, but I've definitely seen a lot of different types of implementations..
ranging from all Javascript approachs such as:
http://javascript.internet.com/calendars/popup-date-picker.html
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.
http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/index.html
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..
-Chris -
Pop-up calendar - any 'best practices' to do this?[ Go to top ]
- Posted by: Marina Prikaschikova
- Posted on: September 28 2004 07:28 EDT
- in response to Joe Attardi
See for example Calendar taglib in Coldtags suite:
http://www.servletsuite.com/jsp.htm
It shows how to return data to the main form