Passed few months ExactTarget (Australia) tried hard win a project with a leading bank in Australia. As we signed our contracts yesterday, they need custom development components to be up and running in 2 weeks time ! YEAH pretty amazing !
There are few things that caught my attention while I crack down the ExactTarget application. Below I have shown the code to open up a pop-up like page and pass back user selections/data back to the pop-up originated page.
Page 1 [Calling Page]
<script language=”javascript”>
function popLookup(url)
{
if(url.indexOf(‘?’) == -1) {
url += “?sf=1″;
}
else {
url += “&sf=1″
}
var dialogW = 500;
var dialogH = 350;
var x = Math.round((document.body.offsetWidth/2)-(dialogW/2));
var y = Math.round((document.body.offsetHeight/2)-(dialogH/2));
var options = “location=no,menubar=no,status=no,resizable=no,toolbar=no,dependent=yes”;
options += “,dialog=no,minimizable=no,modal=no,alwaysRaised=yes,top=”+y+”,left=”+x;
options += “,height=”+dialogH+”,width=”+dialogW;
//var dname = (new Date()).getTime();
var dialog = window.open(url, “Email_Lookup_Dialog”, options)
//dialog.onblur = dialog.close;
dialog.focus();
win=dialog;
}
function SetAltEmailValues(intEmailID, strEmailName, strSubject)
{
win.close(); //Close the pop-up
document.getElementById(‘_EmailIDHidden’).value = intEmailID; // – - -> _EmailIDHidden can be text box name
document.getElementById(‘_EmailNameCell’).value = strEmailName; // – - -> _EmailNameCell can be text box name
document.getElementById(‘_SubjectCell’).value = strSubject; // – - -> _SubjectCell can be text box name
}
</script>
<div onclick=’popLookup(“page2.html”)’ >Click Here </div>
Page 2 [Pop Up]
<script language=”javascript”>
function SelectEmail(intEmailID, strEmailName, strSubject)
{
// This is the trick. When you call this function it refers to the original page which this page was fired up.
window.opener.SetAltEmailValues(intEmailID, strEmailName, strSubject);
}
</script>
</head>
<body>
<form name=”test1″ method=”get”>
<input type=”button” onclick=’SelectEmail(“passingValue 1″, “passingValue 2″, “passingValue 3″)’ title=”Click Here”/>
</form>
</body>