FW: [Solar-talk] Date Fields

Kilbride, James P. James.Kilbride at gd-ais.com
Wed May 7 08:52:11 CDT 2008


Also, there were a couple of questions I had about the new date classes.
I didn't seen any responses to them last week so I'm assuming i have to
pull off the elements individually rather than as a whole? Also assuming
I can't change the order through an 'attribs' setting for the format of
the display and that there is no way to specify arrays of valid 'date
elements'(like valid years, months, etc.) to fit the dates to my 'own
desires' as of right now, is that right?

James Kilbride 

-----Original Message-----
From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Kilbride,
James P.
Sent: Friday, May 02, 2008 12:35 PM
To: solar-talk at lists.solarphp.com
Subject: RE: [Solar-talk] Date Fields

Before I would pull off 'Values' array and retrieve my values to shove
back into my table. How do I do that now?

old: 					
		$this->matrixForm->setElement('resultDate', array(
  			'type'  	=> 'text',
  			'label' 	=> 'Result Date:',
  			'filters'	=> array(
					'SanitizeTrim',
 					'ValidateIsoDate', 
 				),
  			'attribs' 	=> $baseAttribs+array(
					'size' =>10,
					'maxlength' => 10,
				),
  			'value'		=> $currMatrix->result_date,
  			)
		);
$values = $this->matrixForm->getValues(); ...something here...
'result_date' => $values['resultDate'],


now I use:
		$this->matrixForm->setElement('resultDate', array(
  			'type'  	=> 'date',
  			'label' 	=> 'Result Date:',
  			'filters'	=> array(
					'SanitizeTrim',
 					'ValidateIsoDate', 
 				),
  			'attribs' 	=> $baseAttribs+array(
					'size' =>10,
					'maxlength' => 10,
				),
  			'value'		=> $currMatrix->result_date,
  			)
		);
$values = $this->matrixForm->getValues(); ...something here...
'result_date' => ???????????,					 


-----Original Message-----
From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Paul M Jones
Sent: Friday, May 02, 2008 11:51 AM
To: solar-talk at lists.solarphp.com
Subject: Re: [Solar-talk] Date Fields


On May 2, 2008, at 11:36 , Kilbride, James P. wrote:
> So, when putting date fields on forms what do people like to use for 
> the format and are there any helpers that people have for dates that 
> make it easier for people to enter them 'correctly'?
>

Just added some stuff in SVN earlier this week (late last week?) that
helps with this.

First, the validate and sanitize filters for date/time/timestamp now
additionally take array values, where the keys map to date() format keys
(Y, m, d, H, i, s).  Validate will attempt to validate an array with
those keys, and sanitize will take an array with those keys and convert
it into an ISO string.  (This is in addition to the previously existing
behavior of validating and sanitizing strings.)

Once that was in place, I added view helpers formDate, formTime, and
formTimestamp().  These present the temporal values as a series of
select/options, so you can pick the year, month, day, hour, and minute
separately.  They return the individual values as part of an array, so
the validate and sanitize filters will pick them up and handle them
correctly.

You can see some of the relevant code here:

   <http://solarphp.com/svn/trunk/Solar/Filter/ValidateIsoTimestamp.php>

   <http://solarphp.com/svn/trunk/Solar/Filter/SanitizeIsoTimestamp.php>

   <http://solarphp.com/svn/trunk/Solar/View/Helper/FormTimestamp.php>

(The "date" and "time" versions of these are highly similar.)

Hope this helps, please let me know if it does not.


-- pmj
_______________________________________________
Solar-talk mailing list
Solar-talk at lists.solarphp.com
http://mailman-mail3.webfaction.com/listinfo/solar-talk

_______________________________________________
Solar-talk mailing list
Solar-talk at lists.solarphp.com
http://mailman-mail3.webfaction.com/listinfo/solar-talk



More information about the Solar-talk mailing list