0

I have a Form in my Admin view with a small output "console". I want to update the content of the Console, while the form is submitted.

So here's my outputform.phtml:

 <div class="entry-edit">
    <form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/post')?>" enctype="multipart/form-data">
        <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

<input name="data" type="file" id="upload" value="UploadData"  accept="text/csv" />

<button onclick="check()" class="scalable save" type="button"><span> Send</span></button>





<!----- Output  Console ------------------->
<div style="height:130px; width:500px;overflow-x:hidden; overflow-y:auto;">
<table style="width:100%;" border="0" cellspacing="1" cellpadding="2"  name="faultOutput">
</table>
</div>
</form>
</div>

so after my form is submitted, the postAction() Method is called in my Controller.php file.

 public function postAction()
    {
        $post = $this->getRequest()->getPost();
        try {
            if (empty($post)) {
                Mage::throwException($this->__('Invalid form data.'));
            }
           catch(){}
         ..............
    }

Now i want to update the outputconsole of my outputform.phtml by calling a javascript function within the file. But how can i call it within the postAction() php method?

Thanks in advance

1
  • Will you please provide details - 1 - is this custom module or existing? 2- if this is custom module then at what is the location of your block files in Admin section? Please provide more details that we can help you. Commented Jul 19, 2015 at 11:11

2 Answers 2

1

Conceptually this won't work. The PHP is all rendered ahead of time (i.e. before your user takes any action). To execute PHP code after the page is already loaded you would use AJAX to make an additional request. If you don't want to mess with any of that, you could just pop the results up in a new window.

0

So this means, since I would pop the results up in a separate window, I wouldn't need to call a javascript function anymore, Thanks!

But still I don't really get how to put the results in my postAction() method in a separate window

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.