Add custom Select to contact form Magento 2 - Theme Luma The 2019 Stack Overflow Developer Survey Results Are InAdd custom field to contact form Magento 2?Luma theme mobile menu errorAdd a “Contact us” form on each productMagento 2 Add new field to Magento_User admin formHow to add subject and attachment field in contact form?contact form edit fieldsAdd checkbox required in checkout page Magento 2 LumaAdd new custom field in magento 2 contact formSend Contact Form To Different Email, Depending on Select Value?magento 2 luma theme - container names

How come people say “Would of”?

How to type this arrow in math mode?

Mathematics of imaging the black hole

Why does the nucleus not repel itself?

Button changing its text & action. Good or terrible?

Worn-tile Scrabble

What is preventing me from simply constructing a hash that's lower than the current target?

Deal with toxic manager when you can't quit

How to support a colleague who finds meetings extremely tiring?

What do hard-Brexiteers want with respect to the Irish border?

Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?

Why is the maximum length of OpenWrt’s root password 8 characters?

Is it okay to consider publishing in my first year of PhD?

What is the most efficient way to store a numeric range?

How to notate time signature switching consistently every measure

Geography at the pixel level

Can we generate random numbers using irrational numbers like π and e?

Can I have a signal generator on while it's not connected?

Likelihood that a superbug or lethal virus could come from a landfill

Does HR tell a hiring manager about salary negotiations?

What do I do when my TA workload is more than expected?

What is this sharp, curved notch on my knife for?

How can I add encounters in the Lost Mine of Phandelver campaign without giving PCs too much XP?

Why didn't the Event Horizon Telescope team mention Sagittarius A*?



Add custom Select to contact form Magento 2 - Theme Luma



The 2019 Stack Overflow Developer Survey Results Are InAdd custom field to contact form Magento 2?Luma theme mobile menu errorAdd a “Contact us” form on each productMagento 2 Add new field to Magento_User admin formHow to add subject and attachment field in contact form?contact form edit fieldsAdd checkbox required in checkout page Magento 2 LumaAdd new custom field in magento 2 contact formSend Contact Form To Different Email, Depending on Select Value?magento 2 luma theme - container names



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








0















following other guides, I added in the page form to



/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml



and I added the code



<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>


I adjusted the template that I get email but the field is always empty.



trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment


What am I doing wrong? how can i fix it?










share|improve this question
























  • Could you share what variable you have added in your email template ?

    – Pawan
    Mar 20 '18 at 4:52











  • I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.

    – Alessandro
    Mar 20 '18 at 8:43












  • Don't update the core modules files, you have to override the module-contactthen you update the phtml as you need in a new one !

    – PЯINCƏ
    Mar 21 '18 at 19:49











  • how can i do this?

    – Alessandro
    Mar 21 '18 at 20:34

















0















following other guides, I added in the page form to



/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml



and I added the code



<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>


I adjusted the template that I get email but the field is always empty.



trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment


What am I doing wrong? how can i fix it?










share|improve this question
























  • Could you share what variable you have added in your email template ?

    – Pawan
    Mar 20 '18 at 4:52











  • I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.

    – Alessandro
    Mar 20 '18 at 8:43












  • Don't update the core modules files, you have to override the module-contactthen you update the phtml as you need in a new one !

    – PЯINCƏ
    Mar 21 '18 at 19:49











  • how can i do this?

    – Alessandro
    Mar 21 '18 at 20:34













0












0








0








following other guides, I added in the page form to



/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml



and I added the code



<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>


I adjusted the template that I get email but the field is always empty.



trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment


What am I doing wrong? how can i fix it?










share|improve this question
















following other guides, I added in the page form to



/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml



and I added the code



<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>


I adjusted the template that I get email but the field is always empty.



trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment


What am I doing wrong? how can i fix it?







magento2 magento-2.1 forms luma-theme contact-form






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 '18 at 18:43







Alessandro

















asked Mar 19 '18 at 17:37









AlessandroAlessandro

75110




75110












  • Could you share what variable you have added in your email template ?

    – Pawan
    Mar 20 '18 at 4:52











  • I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.

    – Alessandro
    Mar 20 '18 at 8:43












  • Don't update the core modules files, you have to override the module-contactthen you update the phtml as you need in a new one !

    – PЯINCƏ
    Mar 21 '18 at 19:49











  • how can i do this?

    – Alessandro
    Mar 21 '18 at 20:34

















  • Could you share what variable you have added in your email template ?

    – Pawan
    Mar 20 '18 at 4:52











  • I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.

    – Alessandro
    Mar 20 '18 at 8:43












  • Don't update the core modules files, you have to override the module-contactthen you update the phtml as you need in a new one !

    – PЯINCƏ
    Mar 21 '18 at 19:49











  • how can i do this?

    – Alessandro
    Mar 21 '18 at 20:34
















Could you share what variable you have added in your email template ?

– Pawan
Mar 20 '18 at 4:52





Could you share what variable you have added in your email template ?

– Pawan
Mar 20 '18 at 4:52













I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.

– Alessandro
Mar 20 '18 at 8:43






I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.

– Alessandro
Mar 20 '18 at 8:43














Don't update the core modules files, you have to override the module-contactthen you update the phtml as you need in a new one !

– PЯINCƏ
Mar 21 '18 at 19:49





Don't update the core modules files, you have to override the module-contactthen you update the phtml as you need in a new one !

– PЯINCƏ
Mar 21 '18 at 19:49













how can i do this?

– Alessandro
Mar 21 '18 at 20:34





how can i do this?

– Alessandro
Mar 21 '18 at 20:34










1 Answer
1






active

oldest

votes


















0














I did this in Magento 2.2.X



1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:



<div class="field region input-box">
<label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
<select name="dropdown" id="dropdown">
<option value="selected">select…</option>
<option name="retail" value="Retail">Retail</option>
<option name="wholesale" value="Wholesale">Wholesale</option>
<option name="customerservice" value="CustomerService">Customer Service</option>
<option name="logistics" value="logistics">Logistics</option>
<option name="general" value="General">General</option>
</select>
</div>


2) Run this code:



php bin/magento setup:upgrade
php bin/magento cache:flush


3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one



4) In Load default template choose a template in this case Contact Form and click on the button Load Template.



5) Add a name to the template.



6) In template content Open a space in the code and place this:



<tr>
<td><b>trans "Region"</b></td>
<td>var data.dropdown</td>
</tr>


7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.






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%2f218935%2fadd-custom-select-to-contact-form-magento-2-theme-luma%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 did this in Magento 2.2.X



    1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:



    <div class="field region input-box">
    <label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
    <select name="dropdown" id="dropdown">
    <option value="selected">select…</option>
    <option name="retail" value="Retail">Retail</option>
    <option name="wholesale" value="Wholesale">Wholesale</option>
    <option name="customerservice" value="CustomerService">Customer Service</option>
    <option name="logistics" value="logistics">Logistics</option>
    <option name="general" value="General">General</option>
    </select>
    </div>


    2) Run this code:



    php bin/magento setup:upgrade
    php bin/magento cache:flush


    3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one



    4) In Load default template choose a template in this case Contact Form and click on the button Load Template.



    5) Add a name to the template.



    6) In template content Open a space in the code and place this:



    <tr>
    <td><b>trans "Region"</b></td>
    <td>var data.dropdown</td>
    </tr>


    7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.






    share|improve this answer





























      0














      I did this in Magento 2.2.X



      1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:



      <div class="field region input-box">
      <label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
      <select name="dropdown" id="dropdown">
      <option value="selected">select…</option>
      <option name="retail" value="Retail">Retail</option>
      <option name="wholesale" value="Wholesale">Wholesale</option>
      <option name="customerservice" value="CustomerService">Customer Service</option>
      <option name="logistics" value="logistics">Logistics</option>
      <option name="general" value="General">General</option>
      </select>
      </div>


      2) Run this code:



      php bin/magento setup:upgrade
      php bin/magento cache:flush


      3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one



      4) In Load default template choose a template in this case Contact Form and click on the button Load Template.



      5) Add a name to the template.



      6) In template content Open a space in the code and place this:



      <tr>
      <td><b>trans "Region"</b></td>
      <td>var data.dropdown</td>
      </tr>


      7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.






      share|improve this answer



























        0












        0








        0







        I did this in Magento 2.2.X



        1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:



        <div class="field region input-box">
        <label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
        <select name="dropdown" id="dropdown">
        <option value="selected">select…</option>
        <option name="retail" value="Retail">Retail</option>
        <option name="wholesale" value="Wholesale">Wholesale</option>
        <option name="customerservice" value="CustomerService">Customer Service</option>
        <option name="logistics" value="logistics">Logistics</option>
        <option name="general" value="General">General</option>
        </select>
        </div>


        2) Run this code:



        php bin/magento setup:upgrade
        php bin/magento cache:flush


        3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one



        4) In Load default template choose a template in this case Contact Form and click on the button Load Template.



        5) Add a name to the template.



        6) In template content Open a space in the code and place this:



        <tr>
        <td><b>trans "Region"</b></td>
        <td>var data.dropdown</td>
        </tr>


        7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.






        share|improve this answer















        I did this in Magento 2.2.X



        1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:



        <div class="field region input-box">
        <label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
        <select name="dropdown" id="dropdown">
        <option value="selected">select…</option>
        <option name="retail" value="Retail">Retail</option>
        <option name="wholesale" value="Wholesale">Wholesale</option>
        <option name="customerservice" value="CustomerService">Customer Service</option>
        <option name="logistics" value="logistics">Logistics</option>
        <option name="general" value="General">General</option>
        </select>
        </div>


        2) Run this code:



        php bin/magento setup:upgrade
        php bin/magento cache:flush


        3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one



        4) In Load default template choose a template in this case Contact Form and click on the button Load Template.



        5) Add a name to the template.



        6) In template content Open a space in the code and place this:



        <tr>
        <td><b>trans "Region"</b></td>
        <td>var data.dropdown</td>
        </tr>


        7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 4 mins ago









        Abdelkebir ELHARFALI

        468




        468










        answered Oct 9 '18 at 21:11









        MauriceMaurice

        232




        232



























            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%2f218935%2fadd-custom-select-to-contact-form-magento-2-theme-luma%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

            Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

            Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

            How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2