Friday, December 30, 2011

Add a new Document using Dojo

Dojo is toolkit for creating dynamic web user interfaces. Here i save new document with help of dojo popup.

Step 1: Select Xpage-> All Properties->Dojo -> Set the values of dojoParseOnLoad and dojoTheme as True.

Step 2: Create server java script and place the following code:

function dialog_create(id, title1) {
var dialogWidget = dijit.byId(id);
if( dialogWidget )
dialogWidget.destroyRecursive(true);
dialogWidget = new dijit.Dialog({
title: title1, duration:600},
dojo.byId(id));
var dialog = dojo.byId(id);
dialog.parentNode.removeChild(dialog);
var form = document.forms[0];
form.appendChild(dialog);
}

function dialog_create(dojoid, Popuptitle) {

var dialogWidget = dijit.byId(dojoid);

if( dialogWidget )

dialogWidget.destroyRecursive(true);

dialogWidget = new dijit.Dialog({

title: Popuptitle, duration:600},

dojo.byId(dojoid));

var dialog = dojo.byId(dojoid);

dialog.parentNode.removeChild(dialog);

var form = document.forms[0];

form.appendChild(dialog);

}

step 3: Select Xpage-> Resources-> Add this create script.

step 4: Within div tag, create the some fields and set id name as “Add” and Create one button for save the document.

step 5: Then On click event of Save button, write the code: dijit.byId(”Add”).show()

step 6: The preview this page in web browser and then see the result.

No comments:

Post a Comment