A
A
alex_maldinsky2018-01-25 01:42:18
JavaScript
alex_maldinsky, 2018-01-25 01:42:18

How does setValueByObject() work in KLADR?

Good evening. Please tell me on the following question:
I substitute the name of the city in the field, you need to set all the data from the cladre to this field without user participation.

var $container_address = $('.checkout-address'),
                                $region = $container_address.find('#input-region'),
                                $city = $container_address.find('#input-city');
                            $region.kladr({
                                type: $.kladr.type.region,
                                verify: true
                            });
                            $city.kladr({
                                type: $.kladr.type.city,
                                parentInput: '#input-region',
                                limit: 7,
                                typeCode: $.kladr.typeCode.city + $.kladr.typeCode.settlement + $.kladr.typeCode.village,
                                verify: true
                            });

Next I do:
$region.kladr('controller').setValueByObject($region);
$city.kladr('controller').setValueByObject($city);

Tried many different variations, but nothing worked. It was obtained through setValueByName, but it does not take into account the parameters of the kladr object (i.e. in my case, when setting the city, it did not take into account the value of the parent element)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question