Thanks for this nice hint, Mark. I'll place it there. :-) On Tue, Dec 14, 2010 at 12:19 AM, euromark <[email protected]> wrote: > you should do that in the action > in the else part of if (!empty($this->data)): > > http://www.dereuromark.de/2010/10/07/cakephp-beginner-tips/ > > > On 13 Dez., 16:59, psybear83 <[email protected]> wrote: >> Hey guys >> >> I'm creating a form using the Form helper, and I'd like to send >> default values using named params: >> >> /users/add/first_name:max/last_name:miller >> >> I've already come so far that the input() accepts default values for >> text fields and dropdown lists: >> >> echo $this->Form->create(null, array('url' => '/'.$this->params['url'] >> ['url'])); >> foreach($scaffoldFields as $field) { >> $selected = null; >> if(empty($this->data) && isset($this->params['named'][$field])) { // >> When there's no data present (sent using POST or loaded from the >> database), then apply any default values from named parameters! >> $selected = $this->params['named'][$field]; >> } >> echo $this->Form->input($field, array('selected' => $selected, >> 'default' => $selected)); // TODO: Not very nice to have both selected >> (dropdown) and default (text) keys here...!} >> >> echo $this->Form->end(__('Submit', true)); >> >> But I'm unsure on how to implement this for checkboxes and multi >> select lists? For this I'd have to know what sort of field the helper >> creates, and then e.g. I could send an array of values as default. >> >> Is there an easy way to examine what sort of input field will be >> created by the Form helper? >> >> Thanks, >> Josh > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en >
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
