Friday, June 18, 2010

$form->input interpreting 0 as unset in first parameter

This has me beat. I'm trying to create an array of fields in cakePHP
1.3 & PHP 5.3.2
The array is zero based. On the first iteration, $count == 0. For some
reason the string concatenation seems to convert this to null or unset
which cake then interprets as "insert controller name here", viz:

for($count=0;$count<$num;$count++)
{
echo $form->input($count.'.NodeDescriptor.title');
}

OUTPUTS (cleaned of fluff for clarity):

<input name="data[NodeDescriptor][NodeDescriptor][title]" type="text"
id="NodeDescriptorNodeDescriptorTitle" />
<input name="data[1][NodeDescriptor][title]" type="text"
id="1NodeDescriptorTitle" />
...

I've tried casting the value, strval'ing it, single quotes, double
quotes, double quotes and {} to no avail. Is this a PHP feature, a
CakePHP unrobustness or me being dumb?

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate