I need some help with the jQuery Birthday Picker Form plugin. Once the form is posted or refreshed on same page, it does not remember the selected options. I want to do so that when a date is selected and is submitted, it stores in session and shows that as selected in the form. I found a similar question with answer here, but i could not make it work. (I dont know how to use that) I will be very thankful for any help.
-
The question you're mentioning is only telling you how to set the date programmatically. Have you figured out how store the date in the session yet? Can your server return the proper date when you load the page after submit? Or do you need to store the date in the client? – polarblau Feb 12 '11 at 12:14
2 Answers
When you refresh a browser or post a form the form fields are supposed to reset. That's the expected behavior in browsers. The only browser that doesn't always follow this rule is Firefox. See this post:
IE form input data disappear after browser refresh
As polarblau alluded to in his comment, you could achieve what you're looking for by configuring the server to return the form with the values after the form is posted. You could also prevent the form submit event and submit the form via ajax (maybe checkout this jQuery plugin). This could leave the values that the user selected displaying in the form.
However, a refresh should always reset the form. That's the point of a refresh.
FYI - I've updated the Birthday Picker Form Plugin if you want to take a look. You can now set a default date.
there might be a bug in the plugin as it only sets the default value of the hidden birthdate field but not the individual input fields for day, month and year. But of course, I may be wrong.

- 3,545
- 4
- 37
- 66