Tuesday, November 30, 2010

Re: dynamically changing the type in form helper

What is the value of $type1 when you get the error?
Which version of CakePHP are you using?
What are the values of the other variables when you get the error?
Enjoy,
John

On 1 Dec., 03:09, mochaman <mochama...@gmail.com> wrote:
> 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: