How can I validate my custom checkbox on LayoutProcessor.php The Next CEO of Stack OverflowMagento 2.2.3 - Add custom required validation for companyHow to add new custom field to billing address section in magento2How can we validate individual form field In Magento 2?Adding checkbox to Magento2 Onepage Checkouthow to validate custom filed in admin in magento 2.1?Magento 2.2.0 - checkout_index_index.xml shippingAdditional not workingMagento 2.2.1: Add Custom Upload file attribute in CheckoutCustom fields checkout checkbox toggle required?Magento 2.2.5: How to validate shipping addressMagento2 : How to validate admin grid checkbox column?How Can I add a newsletter checkbox on magento2 checkout

Why is there a PLL in CPU?

Anatomically Correct Mesopelagic Aves

Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?

How long to clear the 'suck zone' of a turbofan after start is initiated?

Why does standard notation not preserve intervals (visually)

Text adventure game code

Only print output after finding pattern

How can I quit an app using Terminal?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Fastest way to shutdown Ubuntu Mate 18.10

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

What makes a siege story/plot interesting?

How to write papers efficiently when English isn't my first language?

Science fiction (dystopian) short story set after WWIII

Error when running sfdx update to 7.1.3 then sfdx push errors

What does this shorthand mean?

How to Reset Passwords on Multiple Websites Easily?

Unreliable Magic - Is it worth it?

MAZDA 3 2006 (UK) - poor acceleration then takes off at 3250 revs

WOW air has ceased operation, can I get my tickets refunded?

Why didn't Khan get resurrected in the Genesis Explosion?

Term for the "extreme-extension" version of a straw man fallacy?

Why were Madagascar and New Zealand discovered so late?

Is HostGator storing my password in plaintext?



How can I validate my custom checkbox on LayoutProcessor.php



The Next CEO of Stack OverflowMagento 2.2.3 - Add custom required validation for companyHow to add new custom field to billing address section in magento2How can we validate individual form field In Magento 2?Adding checkbox to Magento2 Onepage Checkouthow to validate custom filed in admin in magento 2.1?Magento 2.2.0 - checkout_index_index.xml shippingAdditional not workingMagento 2.2.1: Add Custom Upload file attribute in CheckoutCustom fields checkout checkbox toggle required?Magento 2.2.5: How to validate shipping addressMagento2 : How to validate admin grid checkbox column?How Can I add a newsletter checkbox on magento2 checkout










0















I injected this code in LayoutPorcessor of checkout module :



 if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children'])
)
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['subscribe'] = [
'component' => 'Magento_Ui/js/form/element/abstract',
'config' => [
'customScope' => 'shippingAddress',
'template' => 'ui/form/field',
'elementTmpl' => 'ui/form/element/checkbox',
'options' => [],
'id' => 'delivery-date',
],
'dataScope' => 'shippingAddress.newsletter_subscribe',
'label' => 'Sign Up for Newsletter',
'provider' => 'checkoutProvider',
'visible' => true,
'checked' => true,
'validation' => [],
'sortOrder' => 250,
'id' => 'newsletter-subscribe',
'value' => 'subscription',
];



I can see the Newsletter checkbox but how can I validate the information to get consumer email in newsletter_suscriber table ?



I modified too : Model/Shipping-save-processor/default.js



saveShippingInformation: function () {
var payload;

if (!quote.billingAddress() && quote.shippingAddress().canUseForBilling())
selectBillingAddressAction(quote.shippingAddress());


var subscribe = $('[name="newsletter_subscribe"]').is(':checked') ? 1 : 0

payload =
addressInformation:
'shipping_address': quote.shippingAddress(),
'billing_address': quote.billingAddress(),
'shipping_method_code': quote.shippingMethod()['method_code'],
'shipping_carrier_code': quote.shippingMethod()['carrier_code']
extension_attributes:
subscribe: subscribe


;


I need your help please!
Best regards!










share|improve this question






















  • magento.stackexchange.com/questions/262239/…

    – Prathap Gunasekaran
    yesterday











  • HI, thank you for the link but is little different that my exemple :/ I'm still lost... Can you help me show me what I need to do after I putted the layout on LayoutProcessor? I need to validate : 'id' => 'newsletter-subscribe', with JS and after call subscribe function in controller ? I don't know how it work :(

    – user78027
    yesterday











  • Note : I don't want create a module, I just want implement my code directly checkout module to understand the mechanism of Magento 2. Thank you for your help!

    – user78027
    yesterday











  • I know that I need to validate the information of LayoutPorcessor with default-validator but after I don't know what to do to have the email in the newsletter table

    – user78027
    yesterday















0















I injected this code in LayoutPorcessor of checkout module :



 if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children'])
)
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['subscribe'] = [
'component' => 'Magento_Ui/js/form/element/abstract',
'config' => [
'customScope' => 'shippingAddress',
'template' => 'ui/form/field',
'elementTmpl' => 'ui/form/element/checkbox',
'options' => [],
'id' => 'delivery-date',
],
'dataScope' => 'shippingAddress.newsletter_subscribe',
'label' => 'Sign Up for Newsletter',
'provider' => 'checkoutProvider',
'visible' => true,
'checked' => true,
'validation' => [],
'sortOrder' => 250,
'id' => 'newsletter-subscribe',
'value' => 'subscription',
];



I can see the Newsletter checkbox but how can I validate the information to get consumer email in newsletter_suscriber table ?



I modified too : Model/Shipping-save-processor/default.js



saveShippingInformation: function () {
var payload;

if (!quote.billingAddress() && quote.shippingAddress().canUseForBilling())
selectBillingAddressAction(quote.shippingAddress());


var subscribe = $('[name="newsletter_subscribe"]').is(':checked') ? 1 : 0

payload =
addressInformation:
'shipping_address': quote.shippingAddress(),
'billing_address': quote.billingAddress(),
'shipping_method_code': quote.shippingMethod()['method_code'],
'shipping_carrier_code': quote.shippingMethod()['carrier_code']
extension_attributes:
subscribe: subscribe


;


I need your help please!
Best regards!










share|improve this question






















  • magento.stackexchange.com/questions/262239/…

    – Prathap Gunasekaran
    yesterday











  • HI, thank you for the link but is little different that my exemple :/ I'm still lost... Can you help me show me what I need to do after I putted the layout on LayoutProcessor? I need to validate : 'id' => 'newsletter-subscribe', with JS and after call subscribe function in controller ? I don't know how it work :(

    – user78027
    yesterday











  • Note : I don't want create a module, I just want implement my code directly checkout module to understand the mechanism of Magento 2. Thank you for your help!

    – user78027
    yesterday











  • I know that I need to validate the information of LayoutPorcessor with default-validator but after I don't know what to do to have the email in the newsletter table

    – user78027
    yesterday













0












0








0








I injected this code in LayoutPorcessor of checkout module :



 if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children'])
)
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['subscribe'] = [
'component' => 'Magento_Ui/js/form/element/abstract',
'config' => [
'customScope' => 'shippingAddress',
'template' => 'ui/form/field',
'elementTmpl' => 'ui/form/element/checkbox',
'options' => [],
'id' => 'delivery-date',
],
'dataScope' => 'shippingAddress.newsletter_subscribe',
'label' => 'Sign Up for Newsletter',
'provider' => 'checkoutProvider',
'visible' => true,
'checked' => true,
'validation' => [],
'sortOrder' => 250,
'id' => 'newsletter-subscribe',
'value' => 'subscription',
];



I can see the Newsletter checkbox but how can I validate the information to get consumer email in newsletter_suscriber table ?



I modified too : Model/Shipping-save-processor/default.js



saveShippingInformation: function () {
var payload;

if (!quote.billingAddress() && quote.shippingAddress().canUseForBilling())
selectBillingAddressAction(quote.shippingAddress());


var subscribe = $('[name="newsletter_subscribe"]').is(':checked') ? 1 : 0

payload =
addressInformation:
'shipping_address': quote.shippingAddress(),
'billing_address': quote.billingAddress(),
'shipping_method_code': quote.shippingMethod()['method_code'],
'shipping_carrier_code': quote.shippingMethod()['carrier_code']
extension_attributes:
subscribe: subscribe


;


I need your help please!
Best regards!










share|improve this question














I injected this code in LayoutPorcessor of checkout module :



 if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children'])
)
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['shipping-address-fieldset']['children']['subscribe'] = [
'component' => 'Magento_Ui/js/form/element/abstract',
'config' => [
'customScope' => 'shippingAddress',
'template' => 'ui/form/field',
'elementTmpl' => 'ui/form/element/checkbox',
'options' => [],
'id' => 'delivery-date',
],
'dataScope' => 'shippingAddress.newsletter_subscribe',
'label' => 'Sign Up for Newsletter',
'provider' => 'checkoutProvider',
'visible' => true,
'checked' => true,
'validation' => [],
'sortOrder' => 250,
'id' => 'newsletter-subscribe',
'value' => 'subscription',
];



I can see the Newsletter checkbox but how can I validate the information to get consumer email in newsletter_suscriber table ?



I modified too : Model/Shipping-save-processor/default.js



saveShippingInformation: function () {
var payload;

if (!quote.billingAddress() && quote.shippingAddress().canUseForBilling())
selectBillingAddressAction(quote.shippingAddress());


var subscribe = $('[name="newsletter_subscribe"]').is(':checked') ? 1 : 0

payload =
addressInformation:
'shipping_address': quote.shippingAddress(),
'billing_address': quote.billingAddress(),
'shipping_method_code': quote.shippingMethod()['method_code'],
'shipping_carrier_code': quote.shippingMethod()['carrier_code']
extension_attributes:
subscribe: subscribe


;


I need your help please!
Best regards!







magento2 magento-2.1 checkout newsletter-subscriber






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday







user78027



















  • magento.stackexchange.com/questions/262239/…

    – Prathap Gunasekaran
    yesterday











  • HI, thank you for the link but is little different that my exemple :/ I'm still lost... Can you help me show me what I need to do after I putted the layout on LayoutProcessor? I need to validate : 'id' => 'newsletter-subscribe', with JS and after call subscribe function in controller ? I don't know how it work :(

    – user78027
    yesterday











  • Note : I don't want create a module, I just want implement my code directly checkout module to understand the mechanism of Magento 2. Thank you for your help!

    – user78027
    yesterday











  • I know that I need to validate the information of LayoutPorcessor with default-validator but after I don't know what to do to have the email in the newsletter table

    – user78027
    yesterday

















  • magento.stackexchange.com/questions/262239/…

    – Prathap Gunasekaran
    yesterday











  • HI, thank you for the link but is little different that my exemple :/ I'm still lost... Can you help me show me what I need to do after I putted the layout on LayoutProcessor? I need to validate : 'id' => 'newsletter-subscribe', with JS and after call subscribe function in controller ? I don't know how it work :(

    – user78027
    yesterday











  • Note : I don't want create a module, I just want implement my code directly checkout module to understand the mechanism of Magento 2. Thank you for your help!

    – user78027
    yesterday











  • I know that I need to validate the information of LayoutPorcessor with default-validator but after I don't know what to do to have the email in the newsletter table

    – user78027
    yesterday
















magento.stackexchange.com/questions/262239/…

– Prathap Gunasekaran
yesterday





magento.stackexchange.com/questions/262239/…

– Prathap Gunasekaran
yesterday













HI, thank you for the link but is little different that my exemple :/ I'm still lost... Can you help me show me what I need to do after I putted the layout on LayoutProcessor? I need to validate : 'id' => 'newsletter-subscribe', with JS and after call subscribe function in controller ? I don't know how it work :(

– user78027
yesterday





HI, thank you for the link but is little different that my exemple :/ I'm still lost... Can you help me show me what I need to do after I putted the layout on LayoutProcessor? I need to validate : 'id' => 'newsletter-subscribe', with JS and after call subscribe function in controller ? I don't know how it work :(

– user78027
yesterday













Note : I don't want create a module, I just want implement my code directly checkout module to understand the mechanism of Magento 2. Thank you for your help!

– user78027
yesterday





Note : I don't want create a module, I just want implement my code directly checkout module to understand the mechanism of Magento 2. Thank you for your help!

– user78027
yesterday













I know that I need to validate the information of LayoutPorcessor with default-validator but after I don't know what to do to have the email in the newsletter table

– user78027
yesterday





I know that I need to validate the information of LayoutPorcessor with default-validator but after I don't know what to do to have the email in the newsletter table

– user78027
yesterday










0






active

oldest

votes












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%2f267561%2fhow-can-i-validate-my-custom-checkbox-on-layoutprocessor-php%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f267561%2fhow-can-i-validate-my-custom-checkbox-on-layoutprocessor-php%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

Sum ergo cogito? 1 nng

419 nièngy_Soadمي 19bal1.5o_g

Queiggey Chernihivv 9NnOo i Zw X QqKk LpB