Thanks, I understand what you are saying but what I need is to be able
to edit mutliple items at once.
For example if I have to edit 20 countries, clicking on every one,
editing it and saving it would take me alot more time then selecting
the ones I need to edit and having them presented in 1 page to be
edited and saved.
I also need to validate them but, for example, being all
"Country.name" I don't know how to obtain this.

For the part about the parser, Thanks! I'm pretty new to php and
cakephp, but willing to learn.

On Apr 22, 6:49 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> You might find it simpler to, instead creating a form, to put links
> around the country names pointing to an edit method. In the edit view,
> create one form to edit the table fields and one form to delete. So
> you have something like:
>
> <h1>Edit Canada</h1>
>
> echo $form->create('Country', array('action' => 'delete');
> echo $form->hidden('Country.id', array('value' => $some_var));
> echo $form->submit('delete');
> echo $form->end();
>
> echo $form->create('Country', array('action' => 'edit');
> ...
> echo $form->submit('edit');
> echo $form->end();
>
> This way, each action points directly to the corresponding method and
> you only have to deal with one item at a time. I realise that this may
> not be practical but it may work for you.
>
> Regarding $some_var above, your code appears to assume that the
> country IDs & names are going to line up with your counter var $i. I
> may be missing something but that looks odd to me. I'd think it's be
> better (if your $countries array is constructed as $id => $name) to do
> it with a while like so:
>
> foreach ($countries as $key => $name)
> {
>        $html->link($name, "countries/edit/${id}");
>
> }
>
> I've used my link suggestion but it's just as applicable to a form
> setup like you have.
>
> BTW, in your views, you don't need to put <?php ... ?> around every
> line. If you don't have any HTML markup to add then you can just open
> a block:
>
> <?php
> echo $form->create(array('url'=>'/countries/process'));
>
> for($i =0; $i<$countries; $i++) {
>        echo $form->hidden('Country'.$i.'.Country.id');
>        echo $form->input('Country'.$i.'.Country.name');
>
> }
>
> echo $form->submit('Save', array('name'=>'save'));
> echo $form->end();
> ?>
>
> Otherwise, you're making the parser (and anyone who has to look at
> your code) work a lot harder than necessary ;-)

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to