0
votes

With the new version of XPages Database Open Dialog Custom Control from openntf by Lars Buntrock i have been unable to pass the output of the callback to Java Script Server Side or even save the return value to the database. do anybody have idea how to solve this ? the dialogbox was called using a CSJS with the below code:

$.openAppDlgCs.show({load:true, fade:true, callback:setFields, passThrough:''});

below is the setFields code:

function setFields() {
     var dbTitle = "";
    var dbPath = "";
    var dbSrv = "";
    var dbHttpUrl = "";
    var dbNotesUrl = "";
    var dbReplicaId = "";
    var dbbin = "";

try {

    if (arguments.length > 0) {

        var db = arguments[0];
        var passThrough = arguments[1]; 
        dbTitle = (typeof db.title === "undefined") ? "" : db.title;

        dbPath = (typeof db.path === "undefined") ? "" : db.path;

        dbSrv = (typeof db.server === "undefined") ? "" : db.server;

        dbHttpUrl = (typeof db.httpUrl === "undefined") ? "" : db.httpUrl;

        dbNotesUrl = (typeof db.notesUrl === "undefined") ? "" :  db.notesUrl;

    dbReplicaId = (typeof db.replicaId === "undefined") ? "" :     db.replicaId;

        dbbin = dbTitle;
    }
    $("#dbTitle").text(dbTitle);
    $("#dbServer").text(dbSrv);
    $("#dbPath").text(dbPath);
    $("#dbHttpUrl").text(dbHttpUrl);
    $("#dbNotesUrl").text(dbNotesUrl);
    $("#dbReplicaId").text(dbReplicaId);
    $("#dbbin").val(dbbin);//

} catch (e) {

    console.log(arguments.callee.name);

    console.log(e);

}

};

The output was display with the below code:

 <div class="form-group">
   <label for="dbTitle">Title</label>
   <span class="form-control" id="dbTitle"></span>
 </div> 
1
No Code - no answer... Nobody can GUESS what you did wrong without seeing your codeTode
Incomplete code - no answer. Put a complete XPage with a minimal example there. How do you call the function? Why did you decide not tu use named parameters etcstwissel

1 Answers

0
votes

As I wrote on OpenNTF I do not know exactly, if I understand your question correctly :-(. But if you need to use the selected db data on server side, it is possible to use the passThrough function.

Change the click-event as follows:
onclick="$.openAppDlgCs.show({load:true, fade:true, callback:setFields, passThrough:test});"

As you see, we set a function "test" to the dialog open function.

In the "setFields" function (in your example) set the passThrough function:

if (arguments.length > 0) {
var db = arguments[0];
var passThrough = arguments[1];
passThrough();

.....

Write a new function "test"

function test() {
//HERE run for example a Dojo or JQuery ajax call to an XAgent and pass the db data
}

Hope it helps