Tuesday, November 30, 2010

dynamically changing the type in form helper

Hi,

I want to override the input 'type' in my form using the form helper
but it is not picking up my values. Here is a snippet:

echo $form->input($name,array('type'=>$type1,'label'=>$label));

I set $name, $type1, and $label as a strings read in from my config
xml file, however, I get the following error upon rendering the page:

Fatal error: Method name must be a string in form.php on line 878

It appears to be an issue with $type1 since if I replace it with
'text' (ie, hardcoded), then it works but everything is a text box
rather than date or checkbox. I have also tried putting quotes in the
data but no luck...everything just defaults to textarea.

I am a newbie to php and cake so I know it is probably something
simple...

Any assistance is appreciated.
Thanks.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: