I have my custom payment method on the checkout page with the dropdown list. and I want to get that dropdown selected value in knockout js and forward it to the controller and store the dropdown value in my custom table.


      <div class="field field-number required">
                <label for="credit_days" class="label">
                    <span><!-- ko i18n: 'Click & Collect Credit Days'--><!-- /ko --></span>
                <div class="control">
                    <select id="credit_days"
                           data-bind="value:creditDaysSelected(), optionsCaption:'Please chose days...'"
                        <option value="10days">10 Days</option>
                        <option value="20days">20 Days</option>
                        <option value="30days">30 Days</option>
                        <option value="40days">40 Days</option>
                        <option value="requestmore">Request More Days</option>
                <div id="request_more" class="request_more" style="display: none">
                    <label for="request_more_credit_days" class="label">
                    <div class="control" id="require_more">
                        <input type="text" data-validate="{required:true}" name="request_more_credit_days" id="request_more_credit_days" placeholder="Enter credit Days of your choice" required>
                        <button type="submit" class="button primary action"> <span translate="'Submit Request'"/> </button>

I want to store dropdown selected values to my custom DB table at the click of a button using a controller.

Any help will be appreciated. Thanks in advance

2 Answers 2


Check function selectPaymentMethod()


and then you can get the selected payment using

var paymentMethod = quote.paymentMethod();
  • I already getting selected payment method but i want selected value from dropdown which are associated with my custom selected payment method Commented Jun 19, 2019 at 9:07

Replace your Select Field with This Code

data-bind="value:creditDaysSelected, optionsCaption:'Please chose days...'"

And Get Value Using This Code

this.creditDaysSelected = ko.observable();
  • bro using value:creditDaysSelected i am getting already selected credit days. not the options value. and one more thing i don't have any idea about knockout js. It is totally new thing for me. so please give me detailed solution. Commented Jun 19, 2019 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.