Store data to DB

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?, what)?? } Regards, Lukas
4 answers

Try this:

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

Also, check out

Disclaimer: The apidocs are still a work in progress.


What is wrong here:

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

Is it something missing?

Please help or i got a madness, regards, Lukas


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


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");{ 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