How to open a new window after clicking a button?

I need to get data from a form, and redirect to different pages according to different buttons. How can I show the page in a new window? A link won’t get the data in the form, I think.

Thanks!

You should do it with javascript. Take a look to some js tutorial, for example this one.

How can I pass the parameters in the form to the new view?

you can return as json and write a function for manage them.


<script language="javascript" type="text/javascript">

    function buttonRedirect(name){

        date = document.form_fa.refDate.value;

        window.open('fagroup?name='+name+'&ref='+date);

    }

</script>

I did it. Thanks a lot!

maybe




<form target="_blank">

.......

</form>






<div class="row">

  <?php echo $form->labelEx($model,'email_txt');  ?>

  <?php echo $form->textArea($model,'email_txt',array('rows'=>8, 'cols'=>58)); ?>

  <?php echo $form->error($model,'email_txt'); ?>

  <?php $image     = '<img src=' . Yii::app()->baseUrl . '/images/help_16.png  border="0" >';

        $help_file = '<a href=' . Yii::app()->baseUrl . '/help/mail_help.php target="_blank">';

  ?>

  <?php echo $help_file . ' ' . $image ?> </a>

</div>



or better




  <?php $image = CHtml::Image(Yii::app()->baseUrl . '/images/help_16.png', 'Help File');

        $url  = Yii::app()->baseUrl . '/help/mail_help.php';

        echo CHtml::Link($image, $url, array('target'=>'_blank', 'title'=>'Help file'));

  ?>