Welcome Guest, Not a member yet? Register   Sign In
multiple view instances?
#1

[eluser]Xerix[/eluser]
Well, Ive been trying to figure something out.

Currently I am using iFrames to create new upload forms dynamically. Each form should allow you to upload a file to the server. But once I upload the first file and try to add a new upload view, it resets the original one to the same in the second one i.e. blank inputs. So my question is....

Is there any way to dynamically load new instances of a single view such that they operate independently of each other?

eg:
<iFrame id=1>MyView</iFrame>
<iFrame id=2>MyView</iFrame>
<iFrame id=3>MyView</iFrame>
<iFrame id=4>MyView</iFrame>

Here is some code. Within some form I am calling this javascript function to add an iframe.
Code:
//this resides in the main view which handles the frame instances
function upload_file(){
            //Add the upload form here
            document.getElementById("upload_forms")[removed] +=
                '<iframe src="<?php echo base_url();?>main/upload_form" id="upload_target" scrolling="no" name="upload_target" height="65" width="250" frameborder="no"></iframe>'

//This resides in my main controller file to load a new view within the iframe
function upload_form(){
        $uniqueID = md5(uniqid(rand())); //New unique ID
        $data = Array('uniqueID'=>$uniqueID);
        $this->load->view('upload_form_view', $data);
    }

I also changed my code to generate the uniqueID from within the upload.php file which loads the new view. It updates both of them with the uniqueID which I dont want. Any Ideas?




Theme © iAndrew 2016 - Forum software by © MyBB