Pass the value using CHtml::submitButton with onClick

Hi,

I want to pass the form value using CHtml::submitButton and onclick. I try this way but can’t pass the value to the popup window

this value I want to pass

$model->User_id

Can you tell me where should i use this value to pass popup window?




?php echo CHtml::submitButton($model->isNewRecord ? 'Delete' : 'Save', array(

        'name'=>'demandeVersement',

	 	

        'onclick'=>"window.open ('/test/cgi-bin/test.pl', 'nom_interne_de_la_fenetre', config='height=500, width=700, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, directories=yes, status=yes')"

));?>




I don’t think I understand what you’re trying to do. You’re going to have to be more specific about exactly what a user does on your form, where you’re passing this value from, and how you want it to be used on the “popup window”.


//You can pass as get variable to popup window.Try below coding.


<?php echo CHtml::submitButton($model->isNewRecord ? 'Delete' : 'Save', array(

        'name'=>'demandeVersement',

                

        'onclick'=>"window.open ('/test/cgi-bin/test.pl?user_id='".$model->User_id."', 'nom_interne_de_la_fenetre', config='height=500, width=700, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, directories=yes, status=yes')"

));?>

Hi nemo,

I think you don’t need to use submitbutton in this page, you should use ajaxbutton() to pass values to controller and return on success to trigger window.open() with the return data

Do you have any example code for Ajaxbutton?

I tried your example but popup is not working.