Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Multifield Issue in Touch UI - Data not populating in touch dialog

Avatar

Level 2

Hi I have below function to add data back to touch ui dialog . but it collects the data in json format.

But my data is stored in string array as below, so what script I need to write for fetching the data and displaying on touch dialog

  name  -  String[]  - ram, mohan

  place -  String[] - delhi, noida

 

//function to add values into multifield widgets. The values are stored in CRX by collectDataFromFields() as json

        //eg. {"page":"English","path":"/content/geometrixx/en"}
        var addDataInFields = function () {
            alert("test" + "test");
            var mValues = [ <%= StringUtils.join(mValue.get(mName, String[].class), ",") %> ],
                    mName = '<%=mName%>',
                    $fieldSets = $("[class='coral-Form-fieldset'][data-name='" + mName + "']");

            var record, $fields, $field, name;

            $fieldSets.each(function (i, fieldSet) {
                $fields = $(fieldSet).find("[name]");

                record = mValues[i];

                if (!record) {
                    return;
                }

                $fields.each(function (j, field) {
                    $field = $(field);

                    name = $field.attr("name");

                    if (!name) {
                        return;
                    }

                    //strip ./
                    if (name.indexOf("./") == 0) {
                        name = name.substring(2);
                    }

                    $field.val(record[name]);
                });
            });
        };

4 Replies

Avatar

Level 10

See this community article that discusses MultiField in Touch UI: 

https://helpx.adobe.com/experience-manager/using/sightly_multifield.html

Install both packages and use them to see how it works 

Avatar

Level 2

Actually my data is saved as in string format as below , not in json format for multifield touch ui dialog.

Data is getting saved using - sling resourcetype - granite/ui/components/foundation/form/multifield but its not getting populated back to dialog

  name  -  String[]  - ram, mohan

  place -  String[] - delhi, noida

What script i should write so that it gets displayed on touch ui dialog. It should read data in string format.

All examples are there to read the data from json format, i dont want that

Avatar

Level 4

Hi Dev,

Did you get the answer for this or not?

and i have 1 more question to you can you please explain what changes you did to change the data storage from JSON format to String format in case of mutifield touch ui

Thanks

Sahil Garg.

Avatar

Level 2

Same issue i face few days ago so the solution i got is we need to remove "acs-commons-nested" property given in

sling:resourceType - granite/ui/components/foundation/form/fieldset and the name property for this is stored as string array.

hope this helps

Thanks

Prasad