Rijak0 / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
0 stars 0 forks source link

Can't Set DateFormat on Date #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

There should be an option to set the dateFormat for the date method.

You should be able to do something like:

    $form->addDate("Date:", "date", "", array("dateFormat" => 'dd/mm/yy'));

Here is my patch to add this feature:

line 1532:
                    $jqueryDateIDArr[] = $ele->attributes["id"];
                    $jqueryDateFormat[] = $ele->attributes["dateFormat"];

line 2031:
            if(!empty($jqueryDateIDArr)) {
                $dateSize = sizeof($jqueryDateIDArr);
                for($d = 0; $d < $dateSize; ++$d) {
                    if( $jqueryDateFormat[$d] != '' ) {
                        $str .= "\n\t\t\t" . '$("#' . $jqueryDateIDArr[$d]
. '").datepicker({ dateFormat: "'. $jqueryDateFormat[$d] .'",
showButtonPanel: true });';
                    } else {
                        $str .= "\n\t\t\t" . '$("#' . $jqueryDateIDArr[$d]
. '").datepicker({ dateFormat: "MM d, yy" , showButtonPanel: true });';
                    }
                }
            }

Original issue reported on code.google.com by moncojhr@gmail.com on 3 Mar 2010 at 3:36

GoogleCodeExporter commented 9 years ago

Original comment by ajporterfield@gmail.com on 3 Mar 2010 at 4:47

GoogleCodeExporter commented 9 years ago
I added jqueryDateFormat as a form attribute that can be used to control the 
formatting 
of the dates returned by both the date and daterange fields.  Because this is a 
form 
attribute and not a field attribute, it is specified in the form's 
setAttributes method and 
not when adding each individual date/daterange field with the 
addDate/addDateRange 
method.

A complete reference of available options for the jqueryDateFormat attribute 
can be 
found at http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate.

Original comment by ajporterfield@gmail.com on 3 Mar 2010 at 5:11