Attached are two files that we have modified from XOOPS
2.0.7. 2.0.9 Beta did not modify these files, so these
changes should work fine in 2.0.9 too.
What do they do?
They allow emtpy strings (or more particularly,
non-numeric strings) to be passed to the date select
box created by the xoopsform class, and for those empty
strings to result in YYYY-mm-dd being placed in the box
instead of the current date.
Without this change, the current date is written into a
date select box if the box is initialized with a
non-numeric string, and we feel this is a mistake
because it results in situations where a user just
submits a form but forgets or neglects to enter an
accurate date, so the default value, current date, just
gets passed back from the form, but in fact no date was
actually specified by the user.
Module developers have no way of knowing if the user
actually picked the current date or just ignored the
With this change, or a similar one, a true "null" value
is reflected in the initial state of the box, and so
can be identified accurately as a "no-entry" situation
by a module's own logic when processing the submissions
from the form.
What is changed?
-The line that converts a non-numeric initial value to
the current date is commented.
-A conditional has been added to the render function to
check whether there is a valid initial value for the
box, and if so, sets the initial date in the correct
format, and if not, sets the initial value to be
-The value of $jstime is set in a slightly different
manner, though I'm not certain this makes a significant
difference to the logic of the files (the change was
the result of other "dead-end" attempts to complete
this overall change to the data select box behaviour).
-In the return line, the HTML value variable is set
according to the outcome of the new conditional above.
-A conditional has been added to the ShowCalendar
function around where it parses the value of the box in
order to highlight the correct date in the popup
calendar. The conditional checks to see if the value
in the box is either empty or "YYYY-mm-dd" and if NOT,
parses the date in the box to determine the initial
date selected in the popup calendar, or if so, parses
the current date ($jstime from the previous file).
I would love to see these changes added to 2.0.9 or
2.1. We think these additions make the behaviour of
the date select box a lot more robust, without having
an adverse affect on existing modules (but allow module
developers to handle dates from boxes better if they
want to write their code to take advantage of the
identifiable YYYY-mm-dd default value).
Thanks for reading,