Calling Renderpartial With Validation

as a newbie i have a problem in my yii app that in some index view i have a TbTab to show having two items like under


   <?php

        $this->widget(

                'bootstrap.widgets.TbTabs', array(

            'type' => 'tabs', // 'tabs' or 'pills'

            'tabs' => array(

                

                array(

                    'label' => 'Existing guardians', 

                    'content' => $this->renderPartial('/guardian/pages/_existing_guardians',false,true), 

                    'active' => true),

                array(

                    'label' => 'New Guardian', 

                    'content' => $this->renderPartial('/user/_form', array('model' => new User),true,false)),

            ),

                )   

    );

First tab is working good as it points to a custom php view page. But in second tab i want to show a user Form which is already made i just have to use it. In tab widget i can only render content but can not call a controller with action as Content only takes rendering objects. My link to form is working but when i enter something in form it does not validate and when i submit this, it shows error 400.<br/>

Yes i am missing something but dont know what.Thanks for your help.

That’s because the form validation action would by default take the controller/action of the owning controller. Remember, you are rendering the _form from a different controller.

You could create a class based action for form validation and share it with both controllers. Otherwise, duplicate code.

There might be other hacks possible that I am unaware of. It may not be advisable to use them.

Hi,

Why false,true in first line and in next line true,false…

Please try changing false,true

$this->renderPartial(’/guardian/pages/_existing_guardians’,false,true),

$this->renderPartial(’/user/_form’, array(‘model’ => new User),true,false)),

And please can you post the log file error…