Magento 2 manipulate shipping address fields in chekout via knockout.jsMagento 2: How to set Max Length for Street Address?Merge billing address, shipping address and shipping method on onepageSet Shipping Address via Magento 2 REST APIMagento 2 - Save custom shipping address' fields to quote_address tableMagento2: switch shipping methods placement with address fieldsShipping Address validationMagento 2: Export Order Shipping Address As Separate FieldsRemove street address field and required attribute from shipping addressMagento 2 how to billing address fields under shipping address in shipping pagemagento 2 add custom fields to checkout form below shipping address formShipping address edit content not loading in fields Magento 2
You have no, but can try for yes
Why teach C using scanf without talking about command line arguments?
Does the Bracer of Flying Daggers really let a thief make 4 attacks per round?
Function over a list that depends on the index
Tricky interview question for mid-level C++ developer
Should I work for free if client's requirement changed
Company looks for long-term employees, but I know I won't be interested in staying long
How electronics on board of JWST can survive the low operating temperature while it's difficult to survive lunar night?
Is it possible to have a career in SciComp without contributing to arms research?
The most secure way to handle someone forgetting to verify their account?
Should I have shared a document with a former employee?
I want light controlled by one switch, not two
What could make large expeditions ineffective for exploring territory full of dangers and valuable resources?
Making a Dataset that emulates `ls -tlra`?
What is a Kravchuk transform and how is it related to Fourier transforms?
What's the largest an Earth-like planet can be and support Earth's biosphere?
Brute-force the switchboard
Linux ext4 restore file and directory access rights after bad backup/restore
When we are talking about black hole evaporation - what exactly happens?
Why isn't a binary file shown as 0s and 1s?
Three Subway Escalators
To what extent does asymmetric cryptography secure bitcoin transactions?
Inscriptio Labyrinthica
How did Jayne know when to shoot?
Magento 2 manipulate shipping address fields in chekout via knockout.js
Magento 2: How to set Max Length for Street Address?Merge billing address, shipping address and shipping method on onepageSet Shipping Address via Magento 2 REST APIMagento 2 - Save custom shipping address' fields to quote_address tableMagento2: switch shipping methods placement with address fieldsShipping Address validationMagento 2: Export Order Shipping Address As Separate FieldsRemove street address field and required attribute from shipping addressMagento 2 how to billing address fields under shipping address in shipping pagemagento 2 add custom fields to checkout form below shipping address formShipping address edit content not loading in fields Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
i already know how to add new field to shipping address form in checkout, but i need to modify the behavior of some fields. For example:
- there is a checkbox "Deliver to Packing station";
- if checkbox is selected, "street" fields becomes hidden and not required, but 2 new fields ("Packing station #" and "Post #") becomes visible and required.
I completely stuck with that. I'm not very familiar with knockout, just have read some lessons on it.
Any help/ideas? (except "go learn knockout.js" :))
magento2 onepage-checkout
add a comment |
i already know how to add new field to shipping address form in checkout, but i need to modify the behavior of some fields. For example:
- there is a checkbox "Deliver to Packing station";
- if checkbox is selected, "street" fields becomes hidden and not required, but 2 new fields ("Packing station #" and "Post #") becomes visible and required.
I completely stuck with that. I'm not very familiar with knockout, just have read some lessons on it.
Any help/ideas? (except "go learn knockout.js" :))
magento2 onepage-checkout
magento.stackexchange.com/questions/148951/…
– Ankit Shah
Feb 7 '17 at 9:42
2
not really what i need. I know how to change form via layout. I need to change it dynamically via js
– Styopchik
Feb 7 '17 at 9:49
@Styopchik , did you find the solution. Please can you share it here.
– Sumit Verma
Jul 11 at 12:07
add a comment |
i already know how to add new field to shipping address form in checkout, but i need to modify the behavior of some fields. For example:
- there is a checkbox "Deliver to Packing station";
- if checkbox is selected, "street" fields becomes hidden and not required, but 2 new fields ("Packing station #" and "Post #") becomes visible and required.
I completely stuck with that. I'm not very familiar with knockout, just have read some lessons on it.
Any help/ideas? (except "go learn knockout.js" :))
magento2 onepage-checkout
i already know how to add new field to shipping address form in checkout, but i need to modify the behavior of some fields. For example:
- there is a checkbox "Deliver to Packing station";
- if checkbox is selected, "street" fields becomes hidden and not required, but 2 new fields ("Packing station #" and "Post #") becomes visible and required.
I completely stuck with that. I'm not very familiar with knockout, just have read some lessons on it.
Any help/ideas? (except "go learn knockout.js" :))
magento2 onepage-checkout
magento2 onepage-checkout
asked Feb 7 '17 at 9:30
StyopchikStyopchik
6715 bronze badges
6715 bronze badges
magento.stackexchange.com/questions/148951/…
– Ankit Shah
Feb 7 '17 at 9:42
2
not really what i need. I know how to change form via layout. I need to change it dynamically via js
– Styopchik
Feb 7 '17 at 9:49
@Styopchik , did you find the solution. Please can you share it here.
– Sumit Verma
Jul 11 at 12:07
add a comment |
magento.stackexchange.com/questions/148951/…
– Ankit Shah
Feb 7 '17 at 9:42
2
not really what i need. I know how to change form via layout. I need to change it dynamically via js
– Styopchik
Feb 7 '17 at 9:49
@Styopchik , did you find the solution. Please can you share it here.
– Sumit Verma
Jul 11 at 12:07
magento.stackexchange.com/questions/148951/…
– Ankit Shah
Feb 7 '17 at 9:42
magento.stackexchange.com/questions/148951/…
– Ankit Shah
Feb 7 '17 at 9:42
2
2
not really what i need. I know how to change form via layout. I need to change it dynamically via js
– Styopchik
Feb 7 '17 at 9:49
not really what i need. I know how to change form via layout. I need to change it dynamically via js
– Styopchik
Feb 7 '17 at 9:49
@Styopchik , did you find the solution. Please can you share it here.
– Sumit Verma
Jul 11 at 12:07
@Styopchik , did you find the solution. Please can you share it here.
– Sumit Verma
Jul 11 at 12:07
add a comment |
1 Answer
1
active
oldest
votes
Found solution, here is an example:
define([
'Magento_Ui/js/form/element/single-checkbox'
], function (AbstractField)
'use strict';
return AbstractField.extend(
defaults:
modules:
packing_station_nr: '$ $.parentName .packing_station_nr',
post_nr: '$ $.parentName .post_nr'
,
onCheckedChanged: function ()
this.packing_station_nr().visible(this.checked());
this.post_nr().visible(this.checked());
this._super()
);
);
P.S. this code only toggles fields visibility. Make fields required by default. If field is not visible, validator skips it's validation.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f158499%2fmagento-2-manipulate-shipping-address-fields-in-chekout-via-knockout-js%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
Found solution, here is an example:
define([
'Magento_Ui/js/form/element/single-checkbox'
], function (AbstractField)
'use strict';
return AbstractField.extend(
defaults:
modules:
packing_station_nr: '$ $.parentName .packing_station_nr',
post_nr: '$ $.parentName .post_nr'
,
onCheckedChanged: function ()
this.packing_station_nr().visible(this.checked());
this.post_nr().visible(this.checked());
this._super()
);
);
P.S. this code only toggles fields visibility. Make fields required by default. If field is not visible, validator skips it's validation.
add a comment |
Found solution, here is an example:
define([
'Magento_Ui/js/form/element/single-checkbox'
], function (AbstractField)
'use strict';
return AbstractField.extend(
defaults:
modules:
packing_station_nr: '$ $.parentName .packing_station_nr',
post_nr: '$ $.parentName .post_nr'
,
onCheckedChanged: function ()
this.packing_station_nr().visible(this.checked());
this.post_nr().visible(this.checked());
this._super()
);
);
P.S. this code only toggles fields visibility. Make fields required by default. If field is not visible, validator skips it's validation.
add a comment |
Found solution, here is an example:
define([
'Magento_Ui/js/form/element/single-checkbox'
], function (AbstractField)
'use strict';
return AbstractField.extend(
defaults:
modules:
packing_station_nr: '$ $.parentName .packing_station_nr',
post_nr: '$ $.parentName .post_nr'
,
onCheckedChanged: function ()
this.packing_station_nr().visible(this.checked());
this.post_nr().visible(this.checked());
this._super()
);
);
P.S. this code only toggles fields visibility. Make fields required by default. If field is not visible, validator skips it's validation.
Found solution, here is an example:
define([
'Magento_Ui/js/form/element/single-checkbox'
], function (AbstractField)
'use strict';
return AbstractField.extend(
defaults:
modules:
packing_station_nr: '$ $.parentName .packing_station_nr',
post_nr: '$ $.parentName .post_nr'
,
onCheckedChanged: function ()
this.packing_station_nr().visible(this.checked());
this.post_nr().visible(this.checked());
this._super()
);
);
P.S. this code only toggles fields visibility. Make fields required by default. If field is not visible, validator skips it's validation.
answered Jul 11 at 13:05
StyopchikStyopchik
6715 bronze badges
6715 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f158499%2fmagento-2-manipulate-shipping-address-fields-in-chekout-via-knockout-js%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
magento.stackexchange.com/questions/148951/…
– Ankit Shah
Feb 7 '17 at 9:42
2
not really what i need. I know how to change form via layout. I need to change it dynamically via js
– Styopchik
Feb 7 '17 at 9:49
@Styopchik , did you find the solution. Please can you share it here.
– Sumit Verma
Jul 11 at 12:07