Question

I am using below script on a form (say, form-A) to load another form (form-B) in thickbox, with values passed by controller. First, in form-A, i am selecting one option from dropdown "customerID", then "Add Project" button (with id 'addProject') becomes visible, on clicking which, a thickbox appears with form-B in it. Here, in form-B, i want to pass selected customer. How can I do that? I tried below code, and tried to access the $_GET['custID'] in controller's manage_project function, but it is showing blank. But when i am alerting the url1 (i have commented below), ID is coming there. Below code is in form-A view file.

('#addProject').click(function(){
        var url1='<?php echo SITEURL ?>/xome/invoice/manage_project?TB_iframe=true&height=800&width=700&inlineId=innerDiv&class=thickbox&custID='+$('#customerID').val();

        //alert(url1);
        tb_show('Add More Project',url1,'');
    })
Was it helpful?

Solution

According to documentation at (http://thickbox.net/):

Important to Remember: Add all other query parameters before the TB_iframe parameters. Everything after the "TB" is removed from the URL.

So, try add custID before TB_iframe. And then you will be able to operate with a variable in the script, such as access them via $_GET['custID']. For example:

var url1='<?php echo SITEURL ?>/xome/invoice/manage_project?custID='+$('#customerID').val() + '&TB_iframe=true&height=800&width=700&inlineId=innerDiv&class=thickbox';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top