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

Deal with toxic manager when you can't quit

A female thief is not sold to make restitution -- so what happens instead?

Old scifi movie from the 50s or 60s with men in solid red uniforms who interrogate a spy from the past

Output the Arecibo Message

Short story: child made less intelligent and less attractive

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

What do these terms in Caesar's Gallic Wars mean?

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

How do you keep chess fun when your opponent constantly beats you?

Correct punctuation for showing a character's confusion

RequirePermission not working

Can a flute soloist sit?

Can there be female White Walkers?

I am an eight letter word. What am I?

Why doesn't UInt have a toDouble()?

How do I free up internal storage if I don't have any apps downloaded?

Cooking pasta in a water boiler

Match Roman Numerals

Ubuntu Server install with full GUI

Loose spokes after only a few rides

Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?

How do PCB vias affect signal quality?

How to notate time signature switching consistently every measure

Geography at the pixel level



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 8 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

            Nidaros erkebispedøme

            Birsay

            Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?