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

Avatar

Avatar

devj81705801

Avatar

devj81705801

devj81705801

13-05-2016

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

Replies

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

13-05-2016

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

Avatar

devj81705801

Avatar

devj81705801

devj81705801

15-05-2016

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

Avatar

gargsahil099

Avatar

gargsahil099

gargsahil099

22-11-2017

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

Avatar

VaraPrasad

Avatar

VaraPrasad

VaraPrasad

09-02-2018

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