Managing dates in forms


#1

Hi,

I have a field for the user which is their birthday. I am letting them
edit it and then save it if they want. However, the form displays the
current date/time, and when they save the form without changing the
birthdate (because they do not wish to set it), the current date/time
gets saved to the db. How do I do this? I thought about having a
hidden field which would be the current date/time and after they
submit the form, compare it to the nonhidden value to see if they
changed it, but I feel like that is not a clean way to do it. Any
suggestions? Do I need to clarify more?

Thanks!

Randy S.
removed_email_address@domain.invalid
267.334.6833


#2

Randy S. wrote:

Hi,

I have a field for the user which is their birthday. I am letting them
edit it and then save it if they want. However, the form displays the
current date/time, and when they save the form without changing the
birthdate (because they do not wish to set it), the current date/time
gets saved to the db. How do I do this? I thought about having a
hidden field which would be the current date/time and after they
submit the form, compare it to the nonhidden value to see if they
changed it

But what if their birthday is the current date ?

Something simple like a checkbox include my birthday might be best and
validate that its been checked.