Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Control width and height of an html web page using ribbon work bench

$
0
0

Hi all,

I add a button on Opportunity form using ribbon work bench with the help of that button I opened html web page. When I change  WinMode from window to ModalDialog or ModalessDialog. My code on html stops working that is why I need to to control height and width for my html web page. My code and WindMode images are shown below

<!doctype html>
<html>
<head>
<title>TextBox with Search Icon in HTML and CSS - Tutorial from www.codeofaninja.com</title>
<style>
#search-text-input{
border-top:thin solid #e5e5e5;
border-right:thin solid #e5e5e5;
border-bottom:thin solid #e5e5e5;;
border-left:thin solid #e5e5e5;
box-shadow:0px 1px 1px 1px #e5e5e5;
float:left;
height:19px;
margin:.7em 0 0 .5em;
outline:0;
padding:.4em 0 .4em .6em;
width:183px;
}

#button-holder{
background-color:#f1f1f1;
border-top:0;
box-shadow:1px 1px 1px 1px #e5e5e5;
cursor:pointer;
float:left;
height:10px;
margin:11px 0 0 0;
text-align:center;
width:50px;
}

#button-holder img{
margin:4px;
width:20px;
}
</style>
<script type="text/javascript" src="ClientGlobalContext.js.aspx"></script>
<script src="aw_SDK.REST.js" type="text/javascript"></script>
<script src="aw_json2.js" type="text/javascript"></script>
<script src="win-us94vrpdbek/.../aw_JQuery"></script>
<script type="text/javascript"></script>
<script>
var currentleadId;
var name;
var lookUpItems;
function fnSetValues() {
debugger;

var objecttypecode = 10003;
var serverurl = Xrm.Page.context.getServerUrl();

var url = serverurl + "/_controls/lookup/lookupsingle.aspx?class=null&objecttypes=" + objecttypecode + "&browse=0&ShowNewButton=0&ShowPropButton=1&DefaultType=0";
var oForm = document.getElementById('oForm');
var iHeight = 300;//oForm.oHeight.options[oForm.oHeight.selectedIndex].text;

var sFeatures = "dialogHeight: " + iHeight + "px;";
return sFeatures;
}

function fnOpen() {
var sFeatures = fnSetValues();
lookUpItems = window.showModalDialog("win-us94vrpdbek/.../lookupsingle.aspx;objecttypes=10003&browse=0&ShowNewButton=0&ShowPropButton=1&DefaultType=0", "", sFeatures);
name = lookUpItems.substring(18,54);

if(name == "C3FEEE05-0AA1-E611-B7CD-005056C00008")
{
document.getElementById("search-text-input").value = "Check";
}
else if(name == "FCDA1A0E-0AA1-E611-B7CD-005056C00008")
{
document.getElementById("search-text-input").value = "CLC";
}
else if(name == "4E9879DE-09A1-E611-B7CD-005056C00008")
{
document.getElementById("search-text-input").value = "Credit Card";
}
else if(name == "4DFB9DEB-09A1-E611-B7CD-005056C00008")
{
document.getElementById("search-text-input").value = "Purchase Order";
}
else if(name == "6003DEF2-09A1-E611-B7CD-005056C00008")
{
document.getElementById("search-text-input").value = "SATV";
}
else if(name == "83D67CFE-09A1-E611-B7CD-005056C00008")
{
document.getElementById("search-text-input").value = "VPA";
}
}

function retrieveAccount() {
debugger;

var lookup = new Array();
var lookup = window.top.opener.Xrm.Page.data.entity.attributes.get("aw_paymentmethod").getValue("some val");
if(lookup != undefined || lookup != null)
{
document.getElementById("search-text-input").value = lookup[0].name;
}
}
function closeWin() {
debugger;

if(lookUpItems != undefined)
{
var lookupItemsData = JSON.parse(lookUpItems);
currentleadId = window.parent.opener.Xrm.Page.data.entity.getId();
var PaymentMethod = {
aw_PaymentMethod: {
Id: lookupItemsData.items[0].id,//lookUpItems.substring(18,54), // Guid of the parent account
LogicalName: "aw_paymentmethod"
}
}

debugger;
SDK.REST.updateRecord(
currentleadId,
PaymentMethod,
"Opportunity",
function () {
writeMessage("The account record changes were saved");
},
function (error) {
alert(error.message);
}
);
window.parent.opener.Xrm.Page.data.entity.save();
//window.parent.opener.Xrm.Page.data.refresh();
//ModelessDialog.close();
window.close();
}
else
{
//ModelessDialog.close();
window.close();
}

}
</script>
</head>
<body onload="retrieveAccount()">
<form>

<fieldset>

<legend>Input Payment Method</legend>

<p>

<label>Payment Method</label>

<input type='text' id='search-text-input' onload="retrieveAccount" />
<div id='button-holder'>
<img src='C:\DDrive\CRM Clients\360training.com\QS\AXPCRM-15\magnifying-glass-3-xl.png' onclick="fnOpen()" />
</div>

</p>

</fieldset>

<button type="button" onclick="closeWin()">OK</button>

</form>


</body>
</html>

Thank you


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>