This is just off the top of my head:
function foo()
{
if (!empty($this->data)
{
$this->checkDynamicFields();
//...
}
//...
}
function checkDynamicFields()
{
$fields = array();
/* Go through $this->data looking for whatever dynamic fields
* might be there. If found add its name & value to array.
*/
foreach($this->data['YOUR_MODEL'] as $key => $val)
{
if (IS_A_DYNAMIC_FIELD)
{
$fields[$key] = $val;
}
}
$this->set('dynamic_fields', $fields);
}
in the view:
if (isset($dynamic_fields) && isset($dynamic_fields['something']))
{
// create 'something' input
On Tue, Aug 18, 2009 at 12:01 PM, Luke<[email protected]> wrote:
>
> Hi,
>
> I am having a form, where I want the User to be able to dynamically
> add input fields. I have found some jquery script to achieve this.
> Everything works fine, besides when I have a validation error and the
> Form needs to shown again, the new input field is gone.
>
> Does anyone got an idea how I could solve this? Thanks a lot.
>
> Luke
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---