Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

[Bug] ValuesManager saveData rememberValues (Example included)

$
0
0
Version: v100p_2015-08-10_LGPL

Given:
A dynamicform connected to a valuesManager. Form values are saved using saveData on the ValuesManager.

Issue:
After the save getChangedValues() on the form still returns an object with the previous changed values. getChangedValues on the valuesManager does return an empty object.

Expected result
That dynamicform should return an empty object when connected to a valuesmanager and savedata is called successfully on the valuesmanager.

Example:
Run @ http://www.smartclient.com/docs/10.0/a/system/reference/SmartClient_Explorer.html#jsonServerValidationErrors
Code:

isc.DataSource.create({
    ID: "users",
    dataFormat: "json",
    dataURL:"[ISOMORPHIC]/system/reference/inlineExamples/dataIntegration/json/serverValidationErrors/serverResponse.js",
    fields: [
        {name: "userName", title: "Username", type: "text", required: true, length: 50},
        {name: "firstName", title: "First Name", type: "text", required: true, length: 50},
        {name: "lastName", title: "Last Name", type: "text", required: true, length: 50},
        {name: "email", title: "Email", type: "text", required: true, length: 100},
        {name: "password", title: "Password", type: "password", required: true, length: 20}
    ]
});

isc.ValuesManager.create({
    ID: "boundVM",
    dataSource: "users",
    values : {
        userName: "bsmith",
        firstName: "Bob",
        lastName: "Smith",
        email: "bob@smith.com",
        password: "sekrit"
    }

});
isc.DynamicForm.create({
    ID: "boundForm",
    valuesManager:"boundVM"
});


isc.VLayout.create({
    members: [
        boundForm,
        isc.IButton.create({
            title: "Save",
            click : function () {
                if (boundVM.validate()) boundVM.saveData(function(dsResponse,data){
                    console.log("Form changedValues: " + isc.JSON.encode(boundForm.getChangedValues()));
                                                                                console.log("VM changedValues: " + isc.JSON.encode(boundVM.getChangedValues()));
                                                                });
            }
        })
    ]
});

What to see:
The javascript console will print two lines with the changedValues. The dynamicform still has the previous values.

Viewing all articles
Browse latest Browse all 4756

Trending Articles