Search

I have created a new form for the search but don’t take the css and the stucture of my application. It works but the page that loads is white only with textbox…why??

The view file of search

<div class="form">

<?php echo CHtml::beginForm(); ?>

&lt;?php //echo CHtml::errorSummary(&#036;model); ?&gt;





&#60;&#33;--  &lt;div class=&quot;row&quot; align=&quot;left&quot;&gt;


	&lt;?php echo CHtml::activeLabelEx(&#036;model,'ANAGRA_ID'); ?&gt;


	&lt;?php echo CHtml::activeTextField(&#036;model,'ANAGRA_ID'); ?&gt;


	&lt;?php echo CHtml::error(&#036;model,'ANAGRA_ID'); ?&gt;


&lt;/div&gt;--&#62;





&lt;div class=&quot;row&quot; align=&quot;left&quot;&gt;


	&lt;?php echo CHtml::activeLabelEx(&#036;model,'NOME'); ?&gt;


	&lt;?php echo CHtml::activeTextField(&#036;model,'NOME'); ?&gt;


	&lt;?php echo CHtml::error(&#036;model,'NOME'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot; align=&quot;left&quot;&gt;


	&lt;?php echo CHtml::activeLabelEx(&#036;model,'COGNOME'); ?&gt;


	&lt;?php echo CHtml::activeTextField(&#036;model,'COGNOME'); ?&gt;


	&lt;?php echo CHtml::error(&#036;model,'COGNOME'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row buttons&quot;&gt;


	&lt;?php echo CHtml::submitButton('Search'); ?&gt;


&lt;/div&gt;

<?php echo CHtml::endForm(); ?>

</div><!-- search-form -->

<?php

$this->breadcrumbs=array(

'Anagraves'=&gt;array('index'),


'Search',

);

?>

<h1>Ricerca Studenti</h1>

<ul class="actions">

&lt;li&gt;&lt;?php echo CHtml::link('Lista studenti',array('index')); ?&gt;&lt;/li&gt;


&lt;li&gt;&lt;?php echo CHtml::link('Gestione Studenti',array('admin')); ?&gt;&lt;/li&gt;

</ul><!-- actions -->

<?php echo $this->renderPartial(’_search’, array(‘model’=>$model)); ?>

THE ACTION IN THE CONTROLLER

public function actionSearch()

{


	&#036;model=new anagrafe;


	if(isset(&#036;_POST['anagrafe']))


	{


		&#036;model-&gt;attributes=&#036;_POST['anagrafe'];


		if(&#036;model-&gt;save())


			&#036;this-&gt;redirect(array('view','id'=&gt;&#036;model-&gt;ANAGRA_ID));


	}





	&#036;this-&gt;renderpartial('search',array(


		'model'=&gt;&#036;model,


	));


}

In the controller action, Instead of using


$this->renderpartial('search',array(

'model'=>$model,

));

Use:




$this->render('search',array(

'model'=>$model,

));



Render method will parse any registered JS and CSS files.

P.S

When you post code blocks you might as well paste them under code here tags.

OHHHH…thank you very much…

Now I have anothe problem

When I fill the fields to search (name and surname) … I reload the same page and does not go instead to the view as stated in the controller …

Can you help me?

I have the impression that the code

if ($ model-> save ())

$ This-> redirect (array (‘view’, ‘id’ => $ model-> ANAGRA_ID));

Model-> save () is not true is false, so I reloaded the same page …