[SOLVED] return data to the caller page


suppose that inserting a book to a database of books, and when loading the publisher, the publisher does not exist

i can go to the create page of publisher(with button in same page what open un new window, popUp), create the new publisher and return the new publisher?

when return, complete the field in the caller page (return array(‘code’=>‘999’) )

can be done?


I hope you understand me, i use google translate, jeje

Transmit the publisher id as a get parameter to the page where you create the book or store the current publisher in the session.

If you are opening the new window as a popup, you can make your page to execute the following javascript:

<script language="javascript">

window.opener.getElementById('my_publisher_input').value = <?php echo $model->id; //the new id ?>



It is just an example, the trick is in the "window.opener", that returns the "document" object from the opener page. So, you can develop other behaviors, as a recharge on dropdown, for instance.


the code is




thanks ricardograna !!!!!

obrigado! foi muito útil

Oh, sure!! I forgot that part! rsrs.