<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<meta name="WebPartPageExpansion" content="full" />
<style type="text/css">
ul,ol {text-align: left;}
li {list-style-type: circle; padding-top: 15px;}
.subcontent {width: 500px; margin: 0 auto;}
.domainName {color: Navy; font-weight: bold;}
</style>
<script type="text/javascript">
function closePage(redirectURL) {
createCookie("Test", "ACCEPTED");
window.frameElement.commitPopup();
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, redirectURL);
}
function createCookie(name, value) {
var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
</script>
</head>
<body style="text-align: center;">
<form name="form1" method="post" action="Modal.aspx?IsDlg=1" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wPDwUKLTcxMDYyNDk4OA9kFgICBA9kFgICAQ8WAh4HVmlzaWJsZWdkZJ+th6rM5boAX+jz8z6RusiKXoWY" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK83aGICgKUxcvrDpIDY1zrMzRi62kcWf2pzau3Dch0" />
</div>
<div id="ExSection">
</div>
<input type="submit" name="btn1" value="SITE 1" onclick="closePage('www.home.com/SITE1');" id="btn1" />
<input type="submit" name="btn2" value="SITE 2" onclick="closePage('www.home.com/SITE2');" id="btn2" />
<input type="submit" name="btn3" value="SITE 3" onclick="closePage('www.home.com/SITE3');" id="btn3" />
</div>
</form>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<meta name="WebPartPageExpansion" content="full" />
<style type="text/css">
ul,ol {text-align: left;}
li {list-style-type: circle; padding-top: 15px;}
.subcontent {width: 500px; margin: 0 auto;}
.domainName {color: Navy; font-weight: bold;}
</style>
<script type="text/javascript">
function closePage(redirectURL) {
createCookie("Test", "ACCEPTED");
window.frameElement.commitPopup();
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, redirectURL);
}
function createCookie(name, value) {
var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
</script>
</head>
<body style="text-align: center;">
<form name="form1" method="post" action="Modal.aspx?IsDlg=1" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wPDwUKLTcxMDYyNDk4OA9kFgICBA9kFgICAQ8WAh4HVmlzaWJsZWdkZJ+th6rM5boAX+jz8z6RusiKXoWY" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK83aGICgKUxcvrDpIDY1zrMzRi62kcWf2pzau3Dch0" />
</div>
<div id="ExSection">
</div>
<input type="submit" name="btn1" value="SITE 1" onclick="closePage('www.home.com/SITE1');" id="btn1" />
<input type="submit" name="btn2" value="SITE 2" onclick="closePage('www.home.com/SITE2');" id="btn2" />
<input type="submit" name="btn3" value="SITE 3" onclick="closePage('www.home.com/SITE3');" id="btn3" />
</div>
</form>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<meta name="WebPartPageExpansion" content="full" />
<style type="text/css">
ul,ol {text-align: left;}
li {list-style-type: circle; padding-top: 15px;}
.subcontent {width: 500px; margin: 0 auto;}
.domainName {color: Navy; font-weight: bold;}
</style>
<script type="text/javascript">
function closePage(redirectURL) {
createCookie("Test", "ACCEPTED");
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, redirectURL);
}
function createCookie(name, value) {
var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
</script>
</head>
<body style="text-align: center;">
<form name="form1" method="post" action="Modal.aspx?IsDlg=1" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wPDwUKLTcxMDYyNDk4OA9kFgICBA9kFgICAQ8WAh4HVmlzaWJsZWdkZJ+th6rM5boAX+jz8z6RusiKXoWY" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK83aGICgKUxcvrDpIDY1zrMzRi62kcWf2pzau3Dch0" />
</div>
<div id="ExSection">
</div>
<input type="submit" name="btn1" value="SITE 1" onclick="closePage('www.home.com/SITE1');" id="btn1" />
<input type="submit" name="btn2" value="SITE 2" onclick="closePage('www.home.com/SITE2');" id="btn2" />
<input type="submit" name="btn3" value="SITE 3" onclick="closePage('www.home.com/SITE3');" id="btn3" />
</div>
</form>
I have a SharePoint modal box that is working fineam having errors with one buttonthe redirect. HoweverIt is taking me to the following page www.home.com/SITE1/undefined
I needam implementing cookies and I think this might be the problem. The reason for the cookie is that I do not want the user to changebe prompted when they click back. The modal serves as a quick path to commonly used webpages. So I am going to include my complete code. I utilized 90% of this modal with the designcookie function. I would likeonly wanted to have 3 buttons redirectmodified it to include 3 different websites and the final one cancelmore buttons.
In a CEWP I have SP.UI.ModalDialog.showModalDialog
which creates the box and also have dialogReturnValueCallback: dialogCallback
Modal. Then I have ataspx (page rendered inside the bottom I havemodal)
function<!DOCTYPE dialogCallback(dialogResulthtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<meta name="WebPartPageExpansion" content="full" />
<style type="text/css">
ul,ol returnValue{text-align: left;}
li {list-style-type: circle; padding-top: 15px;}
.subcontent {width: 500px; margin: 0 auto;}
.domainName {color: Navy; font-weight: bold;}
</style>
<script type="text/javascript">
function closePage(redirectURL) {
if createCookie(dialogResult=="Test", "ACCEPTED");
window.frameElement.commitPopup();
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, redirectURL);
}
function createCookie(name, value) {
window.location.href var expires = 'www.mywebsite"";
document.comcookie = name + "=" + value + expires + "; path=/Site1'";
}
} </script>
Then in the HTML I have
</head>
<body style="text-align: center;">
<form name="form1" method="post" action="Modal.aspx?IsDlg=1" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wPDwUKLTcxMDYyNDk4OA9kFgICBA9kFgICAQ8WAh4HVmlzaWJsZWdkZJ+th6rM5boAX+jz8z6RusiKXoWY" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK83aGICgKUxcvrDpIDY1zrMzRi62kcWf2pzau3Dch0" />
</div>
<div id="ExSection">
</div>
<input type="submit" name="btn1" value="Sitevalue="SITE 1" onclick="closePage('www.home.com/SITE1');" id="btn1" />
<input type="submit" name="btn2" value="SITE 2" onclick="closePage('www.home.com/SITE2');" id="btn2" />
<input type="submit" name="btn3" value="SITE 3" onclick="closePage('www.home.com/SITE3');" id="btn3" />
</div>
</form>
The CEWP on the parent pageWhen I click on the button the modal closes and redirects me to the website defined in the function without error. how do I add more buttons and functions to the dialogCallback?
<script type="text/javascript">
function LoadDialog () {
SP.UI.ModalDialog.showModalDialog({
title: "TEST MODAL BOX",
url: "www.home.com/Modal.aspx",
width: 800,
heigth: 600,
dialogReturnValueCallback: dialogCallback
});
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function LoadDialogWrapper() {
var x = readCookie('Test');
if (!x) {
setTimeout("LoadDialog()", 1000);
}
}
function dialogCallback(dialogResult, returnValue) {
if(dialogResult== SP.UI.DialogResult.OK)
{
window.location.href = returnValue;
}
}
_spBodyOnLoadFunctionNames.push("LoadDialogWrapper");
</script>
I have a SharePoint modal box that is working fine with one button. However I need to change the design. I would like to have 3 buttons redirect to 3 different websites and the final one cancel.
In a CEWP I have SP.UI.ModalDialog.showModalDialog
which creates the box and also have dialogReturnValueCallback: dialogCallback
. Then I have at the bottom I have
function dialogCallback(dialogResult, returnValue) {
if(dialogResult== SP.UI.DialogResult.OK)
{
window.location.href = 'www.mywebsite.com/Site1'
}
}
Then in the HTML I have
<div>
<input type="submit" name="btn1" value="Site 1" onclick="closePage();" id="btn1" />
</div>
When I click on the button the modal closes and redirects me to the website defined in the function without error. how do I add more buttons and functions to the dialogCallback?
I am having errors with the redirect. It is taking me to the following page www.home.com/SITE1/undefined
I am implementing cookies and I think this might be the problem. The reason for the cookie is that I do not want the user to be prompted when they click back. The modal serves as a quick path to commonly used webpages. So I am going to include my complete code. I utilized 90% of this modal with the cookie function. I only wanted to modified it to include 3 more buttons.
Modal.aspx (page rendered inside the modal)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<meta name="WebPartPageExpansion" content="full" />
<style type="text/css">
ul,ol {text-align: left;}
li {list-style-type: circle; padding-top: 15px;}
.subcontent {width: 500px; margin: 0 auto;}
.domainName {color: Navy; font-weight: bold;}
</style>
<script type="text/javascript">
function closePage(redirectURL) {
createCookie("Test", "ACCEPTED");
window.frameElement.commitPopup();
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, redirectURL);
}
function createCookie(name, value) {
var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
</script>
</head>
<body style="text-align: center;">
<form name="form1" method="post" action="Modal.aspx?IsDlg=1" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wPDwUKLTcxMDYyNDk4OA9kFgICBA9kFgICAQ8WAh4HVmlzaWJsZWdkZJ+th6rM5boAX+jz8z6RusiKXoWY" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK83aGICgKUxcvrDpIDY1zrMzRi62kcWf2pzau3Dch0" />
</div>
<div id="ExSection">
</div>
<input type="submit" name="btn1" value="SITE 1" onclick="closePage('www.home.com/SITE1');" id="btn1" />
<input type="submit" name="btn2" value="SITE 2" onclick="closePage('www.home.com/SITE2');" id="btn2" />
<input type="submit" name="btn3" value="SITE 3" onclick="closePage('www.home.com/SITE3');" id="btn3" />
</div>
</form>
The CEWP on the parent page<script type="text/javascript">
function LoadDialog () {
SP.UI.ModalDialog.showModalDialog({
title: "TEST MODAL BOX",
url: "www.home.com/Modal.aspx",
width: 800,
heigth: 600,
dialogReturnValueCallback: dialogCallback
});
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function LoadDialogWrapper() {
var x = readCookie('Test');
if (!x) {
setTimeout("LoadDialog()", 1000);
}
}
function dialogCallback(dialogResult, returnValue) {
if(dialogResult== SP.UI.DialogResult.OK)
{
window.location.href = returnValue;
}
}
_spBodyOnLoadFunctionNames.push("LoadDialogWrapper");
</script>
SharePoint 2010 Modal box with multiple button redirects
I have a SharePoint modal box that is working fine with one button. However I need to change the design. I would like to have 3 buttons redirect to 3 different websites and the final one cancel.
In a CEWP I have SP.UI.ModalDialog.showModalDialog
which creates the box and also have dialogReturnValueCallback: dialogCallback
. Then I have at the bottom I have
function dialogCallback(dialogResult, returnValue) {
if(dialogResult== SP.UI.DialogResult.OK)
{
window.location.href = 'www.mywebsite.com/Site1'
}
}
Then in the HTML I have
<div>
<input type="submit" name="btn1" value="Site 1" onclick="closePage();" id="btn1" />
</div>
When I click on the button the modal closes and redirects me to the website defined in the function without error. how do I add more buttons and functions to the dialogCallback?