Thursday, January 29, 2009

unwated underscore (_) prefixes in form fields?

Hi guys,

I have a Tag model, which HABTM Images.
I use the form helper to generate acombined edit tag and its assoc
images form.

I found a bug, in which it was already trying to INSERT tags, never
UPDATE them.

I looked in $data in the controller, and it's something like:


Array
(
[__Token] => Array
(
[key] =>...
[fields] =>...
)

[_Tag] => Array
(
[id] => 1
)

[Tag] => Array
(
[name] => exciting
[description] =>
)

[_Image] => Array
(
[Image] =>
)

[Image] => Array
(
...


As you can see, there's an underscore prefix for certain fields!

The form itself is by the book, i.e:

<?php echo $form->create('Tag');?>
<fieldset>
<legend><?php __('Edit Tag');?></legend>
<?php
echo $form->input('id');
echo $form->input('name');
echo $form->input('description');
?>

</fieldset>
<?php echo $form->end('Submit');?>


Has anyone come across something like this before? Am I doing
something obviously wrong??

Thanks guys,
Elwood

--~--~---------~--~----~------------~-------~--~----~
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: