Obviously one can unset the 'id' field, but there are times we want a
value in the id field, yet still not have the form helper insert that
value into the url.

In the admin_index view, I have the following simple filter form.

echo $form->create($model, array(
                'url' => array_merge(
                                array('action' => 'admin_index'),
                                $this->params['pass']
                        )
        ));
echo $form->input('id', array('type' => 'text') );
echo $form->end();

Now, suppose the user wants to filter by 'id'. He enters a value into
the id field, and presses filter.

When the form comes back, the filter works, but ... the form is
recreated with a submit url which now contains the id value at
position [0] in the passedArgs, so you get:

"admin/products/index/49/id:49" (where 49 is the id value the user was
filtering for)

What it should be :

"admin/products/index/id:49"

Is there any nice way of preventing the form helper from adding the
'id' value to the submit url?

I currently work around the problem by nulling out the id field value
the form object before calling $form->create(), then restore it before
echoing the input field. It works, but is not nice.

Any better ideas?

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 [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

Reply via email to