Thursday, September 4, 2014

Re: Handling Date Year Parts With Text/Number Form Fields?

Yeah, you will need to create your own method for the helper. Take as an example the year() method in the FormHelper

On Thursday, September 4, 2014 5:56:51 AM UTC+2, OJ Tibi - @ojtibi wrote:
Hi Folks,

I'm using text/number fields to let users input year values that aren't restricted by <select> options, and I was just wondering, what's the best way to handle year parts of a date type using text/number input fields? For example, using `$this->Form->number('my_date.year')` in my add/insert view works because CakePHP parses the year/month/date subkeys from $this->request->data properly. On the other hand, this doesn't work in my edit view because the text/number field doesn't split the date parts like Form::input() and its related methods. Should I implement a workaround by manually parsing the date before passing it to the input field, or is there an internal CakePHP helper technique that can take care of year values in text/number fields?

TIA,
OJ

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: