Issue Bug Closed

#81961EXT:form If values in single select field contains dots (f.e. emails) JS saving and rendering fails.

Andriy Khamuliak 07/25/17, 10:48 updated 10/02/18, 10:58

Description

If value of single select field contain dots it fails after saving.
Value with dots should be escaped and saved to yaml in some special notations, because key with dots will fail yaml to array convert also.

So if value of single select field need to be used as recipient email it will not work as it work with any other field where email will be saved as a value in yaml and not as a key as it is in case of single select field.

Reason of bad saving is that all options in JS are splitted by dots.

Core.js line 796

                    while (path.indexOf('.') > 0) {
                        var firstPartOfPath, nextPartOfPath;

                        firstPartOfPath = path.slice(0, path.indexOf('.'));
                        path = path.slice(firstPartOfPath.length + 1);
                        if ($.isNumeric(firstPartOfPath)) {
                            firstPartOfPath = parseInt(firstPartOfPath);
                        }
                        if ('undefined' === $.type(obj[firstPartOfPath])) {
                            nextPartOfPath = path.slice(0, path.indexOf('.'));
                            if ($.isNumeric(nextPartOfPath)) {
                                obj[firstPartOfPath] = [];
                            } else {
                                obj[firstPartOfPath] = {};
                            }
                        }
                        obj = obj[firstPartOfPath];
                    }EXT:form If values in single select field contains dots (f.e. emails) JS saving and rendering fails.   

So if value of single select field need to be used as recipient email it will not work as it work with any other field where email will be saved as a value in yaml and not as a key as it is in case of single select field.

As usual ‘path’ variable here contains value – ‘properties.options.VALUE’, but in case if value contain dots there is ‘properties.options.my.email@test.com’ which brakes all splitting logic.

Reviews 2