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

init() is undefined .

$
0
0

I am trying to debug an Html web resource . I am getting an error init() is undefined.

I am not sure , why the error is coming and how to go about it..

I am not able to find out the error. The method definition for init() is already present..


<meta http-equiv="X-UA-Compatible" content="IE=8,chrome=1">
<!--<script src="../pcm_/js/jquery.js" type="text/javascript"></script>-->
<!--<script src="../xrmc_/js/jquery.min.js" type="text/javascript"></script>-->
<script src="code.jquery.com/.../jquery-ui.js"></script>
<script src="../ClientGlobalContext.js.aspx" type="text/javascript"></script>
<script src="../pcm_/js/json2.js" type="text/javascript"></script>
<script src="../pcm_/js/XrmServiceToolkit.min.js" type="text/javascript"></script>

<script type="text/javascript">
parent.$(document).ready(function () {
debugger;
init();
});

init = function () {

loadContractBlocks();
window.parent.Xrm.Page.getAttribute("pcm_contracttype").addOnChange(loadContractBlocks);

parent.$('#pcmCreateButton').attr('title', localizedString.CreateContractTitle[lcid]);
parent.$('#pcmCreateButton').text(localizedString.CreateContract[lcid]);
};

parent.$.fn.serializeObject = function () {
var o = {};
var a = this.serializeArray();
parent.$.each(a, function () {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};

console.log('create function');

var pcmCreateDocument = function () {

console.log('running function pcmCreateDocument');

if (window.parent.Xrm.Page.data.entity.getIsDirty()) {
console.log('Form is dirty. Save before create document!!!');
window.parent.Xrm.Page.data.entity.save();
} else {
console.log('Form is not dirty. Continue with document creation.');
}

var json = parent.$('form').serializeObject();

if (parent.$.isArray(json.blocks)) {
var guidsAsString = json.blocks.join(',');
callAction(guidsAsString);
}
else {
var guidAsString = json.blocks;
callAction(guidAsString);
}

};

</script>


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images