I'm trying link the form I created in yii, and make it to go to another page. However since I'm new to yii, I'm confused if it's calling the controller, model or view, plus I dont have a clue where the rendering of the new page should be placed.
I've just taken over someone's work and I'm still studying the yii framework itself.
The code for the form is:
<?php $form=$this->beginWidget('CActiveForm', array('id'=>'apply-form','action' =>
'/site/apply','enableAjaxValidation'=>false,'htmlOptions' => array('enctype' => 'multipart/form-data'),)); ?>
and for the site controller its
public function actionApply()
{
$model = new ApplyForm;
if(isset($_POST['ApplyForm']))
{
$model->attributes=$_POST['ApplyForm'];
$stringsubject ="Application for Crunch Marketing-".$_POST['ApplyForm']['fieldName'];
$model->subject = $stringsubject;
if($model->validate())
{
$mailer = new EmailSender();
$success = $mailer->send($model, 'test@crunch.com.ph');
}
}
$this->render('index',array(
'contactModel' => new ContactForm,
'applyModel' => $model,
));
}
I dont know how the flow actually works. I'm used to the standard form action call, so I'm really confused.