I'm working with Cake 1.2 since half a year. Now i don't know how to
save following problem:


i have an edit action in the Post controller:

function edit($id, $option = null) {

      if (!empty($this->data)) {
            $this->data = am($this->data, $this->params['preset']);
      }

      ...

      $this->set('id', $id);
      $this->set('option', $option);

}


now i want to call an action i want to preset some fields:

function presetedit($id, $presetmode = null) {

      if ($presetmode == 'User') {
            $preset = array(
                  'User' => array('id' => 100);
            );
      } else if ($presetmode == 'Tag') {
            $preset = array(
                  'Tag' => array('id' => 100);
            );
      }

      $this->requestAction('edit/'.$id, 'preset' => $preset);

}


but there is one problem:
in the edit-view i have some links like this:

  $html->link($this->action.'/'.$id.'/'.$option);

and of course a form like this:

  $form->create('Post', array('action' => 'edit'));


if the presetedit action is called "news/presetedit/2", the
targets of the links and forms overlapp, because the param
'presetmode' is not transfered...


how to build the edit.ctp view ?
should i use namedArgs? but if i use named args a have to extend the
edit function like this:
(and all other functions, i use requestAction)


function edit($id = null, $option = null) {
      $id = ($this->passedArgs['id']) ? $this->passedArgs['id'] : $id;
      $option = ($this->passedArgs['option']) ? $this-
>passedArgs['option'] : $option;
      ...


this is very complexe, because params of an action can always be set
in different ways:

- standard params in the url
- namedArgs
- ajax params in $this->params['form']['id'] etc.


overall, is this method a good practise to preset some params which
cannot be submitted by the url (cause of security)?


thank you for your help!
roman


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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