Store data to DB

0
Hi all Mendix GURUs. Can somebody help me with this issue? In module Test i have an entity called TestEntity with one attribute a1 for exmaple. Now i want from client (browser) read value from text input and after click on button store this value to my atribute a1. Handling of HTML and other staff, cause me no problem, but the command itself. storeData: function() { var value = this.inputNode; what comes here? mx.processor.save(where, what)?? } Regards, Lukas
asked
4 answers
3

Try this:

obj.set(attr, value);
obj.save({ callback : function () {}});

Also, check out http://apidocs.mendix.com/client/

Disclaimer: The apidocs are still a work in progress.

answered
1

What is wrong here:

saveStaff: function() {
        mx.processor.get("//Staff.Staff[name='Lukasek']", {}, dojo.hitch(this, function(obj) {
            obj.set("test", "test");
            obj.save({
                callback: function() {
                    //i do not want to do anything just store ...
                }
            });
        }));
    },

Is it something missing?

Please help or i got a madness, regards, Lukas

answered
0

Oki thanks, but how can i retrieve the obj at first?

answered
0

Oki i have change signature, now i can get my object, but problem is with save:

saveStaff: function() { mx.processor.get({ xpath: "//Staff.Staff[Name='Lukasek']", callback: function(objs) { if(objs.length == 0) { alert('empty list'); } else { for ( var int = 0; int < objs.length; int++) { var obj = objs[int]; obj.setAttribute("Test", "it works"); mx.processor.save({ mxobj: obj, callback: function() { obj.commit(); } }, this); } } } }, this);
}

From firebug konzole i get http://localhost:8084/xas/change but there is no change in DB. Can you help me?

Regards, Lukas

answered