Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

devj81705801
Level 2
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]);
                });
            });
        };

0 Replies
smacdonald2008
Level 10
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 

devj81705801
Level 2
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

gargsahil099
Level 4
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.

VaraPrasad
Level 2
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