0
 <?php echo $this->Form->create('User', array('plugin'=>'Usermgmt','controller'=>'user','action' => 'search')); ?>
                        <?php echo $this->Form->input("search" ,array('label' => false ))?>

                        <?php echo $this->Form->Submit(__('Search'));?>

This the code am using for search user name am using this code in view\pages\home.ctp and the search function in plugin is Usermgmt .. but now am getting error using above code

when am click on search it goes to url like Exp/users/search but it should be Exp/usermgmt/users/search

1
  • @AD7six cakephp-2.4.5 and actually when am click on search it goes to url like Exp/users/search but it should be Exp/usermgmt/users/search Commented Apr 29, 2014 at 13:53

1 Answer 1

1

The options array is malformed

The second parameter for Form::create is $options - the api (and the source, on which the api is based) lists the available options:

  • type
  • action
  • url
  • default
  • onsubmit
  • inputDefaults
  • encoding

As such, with the following call:

echo $this->Form->create(
    'User', 
    array(
        'plugin'=>'Usermgmt', # <-
        'controller'=>'user', # <-
        'action' => 'search' 
    )
);

Everything marked with an arrow will be ignored.

Use the url key

To change the form action, use the url key:

echo $this->Form->create(
    'User', 
    array(
        'url' => array(
            'plugin'=>'usermgmt',
            'controller'=>'users',
            'action' => 'search'
        )
    )
);
Sign up to request clarification or add additional context in comments.

2 Comments

done it show error in url http://localhost/Projects/Exp/Usermgmt/user/search Error: UsermgmtController could not be found
Is it the right url? You need to think about what you are doing/asking :).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.