I have a scheduling application that users can click on a table field and it will open a form in a new page with the appropriate post data. My users have decided that this is much to difficult and now require to see the schedule and that the form be a popup window so they can see both at the same time. I have the form popup working, but my function is not passing the post data. This is the code:
$(".main td:not(.jobCell):not(.tJCell)").click(function()
{
var roleID = document.getElementById('roleID').value;
var notDept = $('.deptSelect').val();
var myDept = $('#myDept').val();
var $this = $(this);
var colIndex = $this.cellPos().left;
var preCol = colIndex % 2;
if (myDept != notDept)
{
return;
}
if (preCol == 0)
{
colIndex = colIndex /2;
}
else
{
colIndex++;
colIndex = colIndex /2;
}
var row = $this.parent('tr').contents('th:eq(0)').html();
var departmentID = $(".deptSelect").val();
var headerObj = $(this).parents('.main').find('th').eq(colIndex);
var toPass = $.trim(headerObj.text());
var picked = $("#picked").val();
var testDate = new Date(picked + " " + row);
var today = new Date();
var today = new Date(today - 2*60*60*1000);
if (testDate < today)
{
if (roleID > 2)
{
alert (today);
alert("You Cannot Schedule a New Job in the Past!");
}
return;
}
var thisForm = '';
if (roleID == 5)
{
thisForm = '../forms/tentativeJobForm.php';
}
else
{
thisForm ='../forms/newJobForm.php';
}
var f = document.createElement("form");
f.setAttribute('class','jobTime');
f.setAttribute('method','post');
f.setAttribute('action',thisForm);
var iii = document.createElement('input');
iii.setAttribute('type','hidden');
iii.setAttribute('name','departmentID');
iii.setAttribute('value',departmentID);
f.appendChild(iii);
var i = document.createElement('input');
i.setAttribute('type','hidden');
i.setAttribute('name','sTime');
i.setAttribute('value',picked + " " + row);
f.appendChild(i);
var ii = document.createElement('input');
ii.setAttribute('type','hidden');
ii.setAttribute('name','ast');
ii.setAttribute('value',toPass);
f.appendChild(ii);
document.getElementsByTagName('body')[0].appendChild(f);
if (roleID > 2)
$('.jobTime').onsubmit(window.open(thisForm,null,"height=550,width=900,toolbar=0,menubar=0,location=100,status=no,scrollbars=1,resizable=1,right=300,top=100"));
//$('.jobTime').submit();
else
return;
});
I know the function is not posting the data, so my question is 'how do I get the function to open the popup form with the post data?'