UI component hidden input on checkout addressDisplay a custom field with Rendered in Product Grid UI Component in Magento 2Checkout uiComponent (input field) rendered multiple times: how do I apply viewmodel functionality to current input field only?Magento 2 - insertListing ui componentDynamically hide component upon selecting a country in checkoutMagento 2: Override city on CheckoutMagento 2 How to change event of postcode in customer checkout address form?M2 Add fields to custom payment method [ship to multiple address]Problem when validating city field when registering new address at checkout M2Change value of text field in admin form based on option selected in dropdownRender fields base on attributes to system.xml

Why does the Trade Federation become so alarmed upon learning the ambassadors are Jedi Knights?

Align by center of symbol

If I stood next to a piece of metal heated to a million degrees, but in a perfect vacuum, would I feel hot?

Why hasn't the U.S. government paid war reparations to any country it attacked?

Mathematica function equivalent to Matlab's residue function (partial fraction expansion)

Is dividends exclusively a part of earnings?

Old short story where the future emperor of the galaxy is taken for a tour around Earth

Why use null function instead of == [] to check for empty list in Haskell?

Diminished chord constructed over the tonic degree?

I quit, and boss offered me 3 month "grace period" where I could still come back

Can a British citizen travel with a Nigerian passport?

When to ask for constructive criticism?

What to look for in climbing shoes?

What's the phrasal verb for carbonated drinks exploding out of the can after being shaken?

Is there a way to handmake alphabet pasta?

What do mathematicians mean when they say some conjecture can’t be proven using the current technology?

What is the superlative of ipse?

Why did Spider-Man take a detour to Dorset?

What is this old "lemon-squeezer" shaped pan

What are the arguments for California’s nonpartisan blanket primaries?

Construct a pentagon avoiding compass use

Using two linked programs, output ordinal numbers up to n

Can I send medicine to someone in Canada?

Why do legislative committees exist?



UI component hidden input on checkout address


Display a custom field with Rendered in Product Grid UI Component in Magento 2Checkout uiComponent (input field) rendered multiple times: how do I apply viewmodel functionality to current input field only?Magento 2 - insertListing ui componentDynamically hide component upon selecting a country in checkoutMagento 2: Override city on CheckoutMagento 2 How to change event of postcode in customer checkout address form?M2 Add fields to custom payment method [ship to multiple address]Problem when validating city field when registering new address at checkout M2Change value of text field in admin form based on option selected in dropdownRender fields base on attributes to system.xml






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am adding custom field on Magento 2 checkout shipping address.
It's a hidden input.
The value should be automatically updated based on another custom field which is a select (populated from ajax response data), using its option text/label.
How can I "link" between input value and selected option text?



In my current custom component for the select, it already export the value to input



 exports: 
value: '$ $.provider :shippingAddress.custom_attributes.subdstrict:value'



But it sends the selected value instead of the text. how to send the selected option text instead?










share|improve this question






























    0















    I am adding custom field on Magento 2 checkout shipping address.
    It's a hidden input.
    The value should be automatically updated based on another custom field which is a select (populated from ajax response data), using its option text/label.
    How can I "link" between input value and selected option text?



    In my current custom component for the select, it already export the value to input



     exports: 
    value: '$ $.provider :shippingAddress.custom_attributes.subdstrict:value'



    But it sends the selected value instead of the text. how to send the selected option text instead?










    share|improve this question


























      0












      0








      0








      I am adding custom field on Magento 2 checkout shipping address.
      It's a hidden input.
      The value should be automatically updated based on another custom field which is a select (populated from ajax response data), using its option text/label.
      How can I "link" between input value and selected option text?



      In my current custom component for the select, it already export the value to input



       exports: 
      value: '$ $.provider :shippingAddress.custom_attributes.subdstrict:value'



      But it sends the selected value instead of the text. how to send the selected option text instead?










      share|improve this question
















      I am adding custom field on Magento 2 checkout shipping address.
      It's a hidden input.
      The value should be automatically updated based on another custom field which is a select (populated from ajax response data), using its option text/label.
      How can I "link" between input value and selected option text?



      In my current custom component for the select, it already export the value to input



       exports: 
      value: '$ $.provider :shippingAddress.custom_attributes.subdstrict:value'



      But it sends the selected value instead of the text. how to send the selected option text instead?







      magento2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 18 '17 at 7:43









      Teja Bhagavan Kollepara

      3,0144 gold badges21 silver badges51 bronze badges




      3,0144 gold badges21 silver badges51 bronze badges










      asked Oct 18 '17 at 3:57









      Doni WibowoDoni Wibowo

      1152 silver badges13 bronze badges




      1152 silver badges13 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I managed to achieve this using this code



           return Select.extend(
          defaults:
          skipValidation: false,
          exports:
          // Don: any change to subdisrict_id dropdown will "send" notifcation to subdistrict input
          selectedSubdistrictName: '$ $.provider :$ $.customScope .custom_attributes.subdistrict:value'

          ,

          /**
          * @inheritdoc
          */
          initObservable: function ()
          this._super()
          .observe(['selectedSubdistrictName']);

          return this;
          ,

          /**
          * Filters 'initialOptions' property by 'field' and 'value' passed,
          * calls 'setOptions' passing the result to it
          *
          * @param * value
          * @param String field
          */
          initialize : function()
          var self = this;
          this._super();
          self.value.subscribe(function(value)
          self.selectedSubdistrictName( self.getPreview() );
          , this)
          ,

          filter: function (value, field)
          if(value)
          var thisField = this;

          $.ajax(
          type: 'GET',
          url: '/rest/V1/fabelio-directory/subdistricts/' + value,
          dataType: 'json',
          success: function(data)
          // rename keys
          var options = [];
          var option = ;
          for(var i = 0; i < data.length; i++)
          option =
          'value': data[i].subdistrict_id,
          'label': data[i].name
          ;
          options.push(option);


          thisField.setOptions(options);
          ,
          error: function()
          ,
          complete: function()

          );




          );
          });





          share|improve this answer

























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f197683%2fui-component-hidden-input-on-checkout-address%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I managed to achieve this using this code



             return Select.extend(
            defaults:
            skipValidation: false,
            exports:
            // Don: any change to subdisrict_id dropdown will "send" notifcation to subdistrict input
            selectedSubdistrictName: '$ $.provider :$ $.customScope .custom_attributes.subdistrict:value'

            ,

            /**
            * @inheritdoc
            */
            initObservable: function ()
            this._super()
            .observe(['selectedSubdistrictName']);

            return this;
            ,

            /**
            * Filters 'initialOptions' property by 'field' and 'value' passed,
            * calls 'setOptions' passing the result to it
            *
            * @param * value
            * @param String field
            */
            initialize : function()
            var self = this;
            this._super();
            self.value.subscribe(function(value)
            self.selectedSubdistrictName( self.getPreview() );
            , this)
            ,

            filter: function (value, field)
            if(value)
            var thisField = this;

            $.ajax(
            type: 'GET',
            url: '/rest/V1/fabelio-directory/subdistricts/' + value,
            dataType: 'json',
            success: function(data)
            // rename keys
            var options = [];
            var option = ;
            for(var i = 0; i < data.length; i++)
            option =
            'value': data[i].subdistrict_id,
            'label': data[i].name
            ;
            options.push(option);


            thisField.setOptions(options);
            ,
            error: function()
            ,
            complete: function()

            );




            );
            });





            share|improve this answer



























              0














              I managed to achieve this using this code



               return Select.extend(
              defaults:
              skipValidation: false,
              exports:
              // Don: any change to subdisrict_id dropdown will "send" notifcation to subdistrict input
              selectedSubdistrictName: '$ $.provider :$ $.customScope .custom_attributes.subdistrict:value'

              ,

              /**
              * @inheritdoc
              */
              initObservable: function ()
              this._super()
              .observe(['selectedSubdistrictName']);

              return this;
              ,

              /**
              * Filters 'initialOptions' property by 'field' and 'value' passed,
              * calls 'setOptions' passing the result to it
              *
              * @param * value
              * @param String field
              */
              initialize : function()
              var self = this;
              this._super();
              self.value.subscribe(function(value)
              self.selectedSubdistrictName( self.getPreview() );
              , this)
              ,

              filter: function (value, field)
              if(value)
              var thisField = this;

              $.ajax(
              type: 'GET',
              url: '/rest/V1/fabelio-directory/subdistricts/' + value,
              dataType: 'json',
              success: function(data)
              // rename keys
              var options = [];
              var option = ;
              for(var i = 0; i < data.length; i++)
              option =
              'value': data[i].subdistrict_id,
              'label': data[i].name
              ;
              options.push(option);


              thisField.setOptions(options);
              ,
              error: function()
              ,
              complete: function()

              );




              );
              });





              share|improve this answer

























                0












                0








                0







                I managed to achieve this using this code



                 return Select.extend(
                defaults:
                skipValidation: false,
                exports:
                // Don: any change to subdisrict_id dropdown will "send" notifcation to subdistrict input
                selectedSubdistrictName: '$ $.provider :$ $.customScope .custom_attributes.subdistrict:value'

                ,

                /**
                * @inheritdoc
                */
                initObservable: function ()
                this._super()
                .observe(['selectedSubdistrictName']);

                return this;
                ,

                /**
                * Filters 'initialOptions' property by 'field' and 'value' passed,
                * calls 'setOptions' passing the result to it
                *
                * @param * value
                * @param String field
                */
                initialize : function()
                var self = this;
                this._super();
                self.value.subscribe(function(value)
                self.selectedSubdistrictName( self.getPreview() );
                , this)
                ,

                filter: function (value, field)
                if(value)
                var thisField = this;

                $.ajax(
                type: 'GET',
                url: '/rest/V1/fabelio-directory/subdistricts/' + value,
                dataType: 'json',
                success: function(data)
                // rename keys
                var options = [];
                var option = ;
                for(var i = 0; i < data.length; i++)
                option =
                'value': data[i].subdistrict_id,
                'label': data[i].name
                ;
                options.push(option);


                thisField.setOptions(options);
                ,
                error: function()
                ,
                complete: function()

                );




                );
                });





                share|improve this answer













                I managed to achieve this using this code



                 return Select.extend(
                defaults:
                skipValidation: false,
                exports:
                // Don: any change to subdisrict_id dropdown will "send" notifcation to subdistrict input
                selectedSubdistrictName: '$ $.provider :$ $.customScope .custom_attributes.subdistrict:value'

                ,

                /**
                * @inheritdoc
                */
                initObservable: function ()
                this._super()
                .observe(['selectedSubdistrictName']);

                return this;
                ,

                /**
                * Filters 'initialOptions' property by 'field' and 'value' passed,
                * calls 'setOptions' passing the result to it
                *
                * @param * value
                * @param String field
                */
                initialize : function()
                var self = this;
                this._super();
                self.value.subscribe(function(value)
                self.selectedSubdistrictName( self.getPreview() );
                , this)
                ,

                filter: function (value, field)
                if(value)
                var thisField = this;

                $.ajax(
                type: 'GET',
                url: '/rest/V1/fabelio-directory/subdistricts/' + value,
                dataType: 'json',
                success: function(data)
                // rename keys
                var options = [];
                var option = ;
                for(var i = 0; i < data.length; i++)
                option =
                'value': data[i].subdistrict_id,
                'label': data[i].name
                ;
                options.push(option);


                thisField.setOptions(options);
                ,
                error: function()
                ,
                complete: function()

                );




                );
                });






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 19 '17 at 6:15









                Doni WibowoDoni Wibowo

                1152 silver badges13 bronze badges




                1152 silver badges13 bronze badges



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f197683%2fui-component-hidden-input-on-checkout-address%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

                    Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

                    Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림