How to add placeholder in system.xml for custom admin configuration fields in magento 2












1















I am creating field by using this code in my system.xml file of custom module



<field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Physical address</label>
<validate>required-entry</validate>
</field>


The result of this code is as:

enter image description here


Now i want to add placeholder for that custom field. Should i use some custom JS or is there any tag for placeholder?










share|improve this question

























  • you need a placeholder or a default value?

    – Altravista
    Nov 1 '18 at 12:38











  • need only placeholder

    – iqbal malik
    Nov 1 '18 at 12:42











  • @iqbalmalik I think you can add comment to add field description. If you want placeholder then it would required additional customization. See my answer if you wants to add field description..

    – Himmat Paliwal
    Nov 1 '18 at 12:47


















1















I am creating field by using this code in my system.xml file of custom module



<field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Physical address</label>
<validate>required-entry</validate>
</field>


The result of this code is as:

enter image description here


Now i want to add placeholder for that custom field. Should i use some custom JS or is there any tag for placeholder?










share|improve this question

























  • you need a placeholder or a default value?

    – Altravista
    Nov 1 '18 at 12:38











  • need only placeholder

    – iqbal malik
    Nov 1 '18 at 12:42











  • @iqbalmalik I think you can add comment to add field description. If you want placeholder then it would required additional customization. See my answer if you wants to add field description..

    – Himmat Paliwal
    Nov 1 '18 at 12:47
















1












1








1


1






I am creating field by using this code in my system.xml file of custom module



<field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Physical address</label>
<validate>required-entry</validate>
</field>


The result of this code is as:

enter image description here


Now i want to add placeholder for that custom field. Should i use some custom JS or is there any tag for placeholder?










share|improve this question
















I am creating field by using this code in my system.xml file of custom module



<field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Physical address</label>
<validate>required-entry</validate>
</field>


The result of this code is as:

enter image description here


Now i want to add placeholder for that custom field. Should i use some custom JS or is there any tag for placeholder?







magento2 system.xml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 1 '18 at 13:47









Sourabh Kumar Sharma

665316




665316










asked Nov 1 '18 at 12:28









iqbal malikiqbal malik

7311




7311













  • you need a placeholder or a default value?

    – Altravista
    Nov 1 '18 at 12:38











  • need only placeholder

    – iqbal malik
    Nov 1 '18 at 12:42











  • @iqbalmalik I think you can add comment to add field description. If you want placeholder then it would required additional customization. See my answer if you wants to add field description..

    – Himmat Paliwal
    Nov 1 '18 at 12:47





















  • you need a placeholder or a default value?

    – Altravista
    Nov 1 '18 at 12:38











  • need only placeholder

    – iqbal malik
    Nov 1 '18 at 12:42











  • @iqbalmalik I think you can add comment to add field description. If you want placeholder then it would required additional customization. See my answer if you wants to add field description..

    – Himmat Paliwal
    Nov 1 '18 at 12:47



















you need a placeholder or a default value?

– Altravista
Nov 1 '18 at 12:38





you need a placeholder or a default value?

– Altravista
Nov 1 '18 at 12:38













need only placeholder

– iqbal malik
Nov 1 '18 at 12:42





need only placeholder

– iqbal malik
Nov 1 '18 at 12:42













@iqbalmalik I think you can add comment to add field description. If you want placeholder then it would required additional customization. See my answer if you wants to add field description..

– Himmat Paliwal
Nov 1 '18 at 12:47







@iqbalmalik I think you can add comment to add field description. If you want placeholder then it would required additional customization. See my answer if you wants to add field description..

– Himmat Paliwal
Nov 1 '18 at 12:47












2 Answers
2






active

oldest

votes


















1














Magento does not have tag file <placeholder></placeholder> for system.xml which will render as placeholder HTML tag.



If you want to add a placeHolder folder button then you have to create <frontend_model> for this field.



See https://belvg.com/blog/how-to-add-custom-system-configuration-elements-in-magento-2-0.html






share|improve this answer































    0














    You can add comment to particular field, are you looking something like that?



    <comment>Add your field description</comment>


    So in your case, it would be like



    <field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Physical address</label>
    <validate>required-entry</validate>
    <comment>Add your field description</comment>
    </field>





    share|improve this answer
























    • i need placeholder not comment. comment shows under field but i am in need of placeholder inside field

      – iqbal malik
      Nov 1 '18 at 12:46











    • Ok, in that case you can add default values which would be shown when no value is saved.. follow this article for more details magestandard.com/configure-default-field-values-magento-2

      – Himmat Paliwal
      Nov 1 '18 at 12:51













    • see below xml files for further details vendor/magento/module-catalog/etc/system.xml and vendor/magento/module-catalog/etc/config.xml

      – Himmat Paliwal
      Nov 1 '18 at 12:58













    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%2f248746%2fhow-to-add-placeholder-in-system-xml-for-custom-admin-configuration-fields-in-ma%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Magento does not have tag file <placeholder></placeholder> for system.xml which will render as placeholder HTML tag.



    If you want to add a placeHolder folder button then you have to create <frontend_model> for this field.



    See https://belvg.com/blog/how-to-add-custom-system-configuration-elements-in-magento-2-0.html






    share|improve this answer




























      1














      Magento does not have tag file <placeholder></placeholder> for system.xml which will render as placeholder HTML tag.



      If you want to add a placeHolder folder button then you have to create <frontend_model> for this field.



      See https://belvg.com/blog/how-to-add-custom-system-configuration-elements-in-magento-2-0.html






      share|improve this answer


























        1












        1








        1







        Magento does not have tag file <placeholder></placeholder> for system.xml which will render as placeholder HTML tag.



        If you want to add a placeHolder folder button then you have to create <frontend_model> for this field.



        See https://belvg.com/blog/how-to-add-custom-system-configuration-elements-in-magento-2-0.html






        share|improve this answer













        Magento does not have tag file <placeholder></placeholder> for system.xml which will render as placeholder HTML tag.



        If you want to add a placeHolder folder button then you have to create <frontend_model> for this field.



        See https://belvg.com/blog/how-to-add-custom-system-configuration-elements-in-magento-2-0.html







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 1 '18 at 13:30









        Amit BeraAmit Bera

        57.3k1474171




        57.3k1474171

























            0














            You can add comment to particular field, are you looking something like that?



            <comment>Add your field description</comment>


            So in your case, it would be like



            <field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Physical address</label>
            <validate>required-entry</validate>
            <comment>Add your field description</comment>
            </field>





            share|improve this answer
























            • i need placeholder not comment. comment shows under field but i am in need of placeholder inside field

              – iqbal malik
              Nov 1 '18 at 12:46











            • Ok, in that case you can add default values which would be shown when no value is saved.. follow this article for more details magestandard.com/configure-default-field-values-magento-2

              – Himmat Paliwal
              Nov 1 '18 at 12:51













            • see below xml files for further details vendor/magento/module-catalog/etc/system.xml and vendor/magento/module-catalog/etc/config.xml

              – Himmat Paliwal
              Nov 1 '18 at 12:58


















            0














            You can add comment to particular field, are you looking something like that?



            <comment>Add your field description</comment>


            So in your case, it would be like



            <field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Physical address</label>
            <validate>required-entry</validate>
            <comment>Add your field description</comment>
            </field>





            share|improve this answer
























            • i need placeholder not comment. comment shows under field but i am in need of placeholder inside field

              – iqbal malik
              Nov 1 '18 at 12:46











            • Ok, in that case you can add default values which would be shown when no value is saved.. follow this article for more details magestandard.com/configure-default-field-values-magento-2

              – Himmat Paliwal
              Nov 1 '18 at 12:51













            • see below xml files for further details vendor/magento/module-catalog/etc/system.xml and vendor/magento/module-catalog/etc/config.xml

              – Himmat Paliwal
              Nov 1 '18 at 12:58
















            0












            0








            0







            You can add comment to particular field, are you looking something like that?



            <comment>Add your field description</comment>


            So in your case, it would be like



            <field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Physical address</label>
            <validate>required-entry</validate>
            <comment>Add your field description</comment>
            </field>





            share|improve this answer













            You can add comment to particular field, are you looking something like that?



            <comment>Add your field description</comment>


            So in your case, it would be like



            <field id="SenderCity" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Physical address</label>
            <validate>required-entry</validate>
            <comment>Add your field description</comment>
            </field>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 1 '18 at 12:34









            Himmat PaliwalHimmat Paliwal

            1,135418




            1,135418













            • i need placeholder not comment. comment shows under field but i am in need of placeholder inside field

              – iqbal malik
              Nov 1 '18 at 12:46











            • Ok, in that case you can add default values which would be shown when no value is saved.. follow this article for more details magestandard.com/configure-default-field-values-magento-2

              – Himmat Paliwal
              Nov 1 '18 at 12:51













            • see below xml files for further details vendor/magento/module-catalog/etc/system.xml and vendor/magento/module-catalog/etc/config.xml

              – Himmat Paliwal
              Nov 1 '18 at 12:58





















            • i need placeholder not comment. comment shows under field but i am in need of placeholder inside field

              – iqbal malik
              Nov 1 '18 at 12:46











            • Ok, in that case you can add default values which would be shown when no value is saved.. follow this article for more details magestandard.com/configure-default-field-values-magento-2

              – Himmat Paliwal
              Nov 1 '18 at 12:51













            • see below xml files for further details vendor/magento/module-catalog/etc/system.xml and vendor/magento/module-catalog/etc/config.xml

              – Himmat Paliwal
              Nov 1 '18 at 12:58



















            i need placeholder not comment. comment shows under field but i am in need of placeholder inside field

            – iqbal malik
            Nov 1 '18 at 12:46





            i need placeholder not comment. comment shows under field but i am in need of placeholder inside field

            – iqbal malik
            Nov 1 '18 at 12:46













            Ok, in that case you can add default values which would be shown when no value is saved.. follow this article for more details magestandard.com/configure-default-field-values-magento-2

            – Himmat Paliwal
            Nov 1 '18 at 12:51







            Ok, in that case you can add default values which would be shown when no value is saved.. follow this article for more details magestandard.com/configure-default-field-values-magento-2

            – Himmat Paliwal
            Nov 1 '18 at 12:51















            see below xml files for further details vendor/magento/module-catalog/etc/system.xml and vendor/magento/module-catalog/etc/config.xml

            – Himmat Paliwal
            Nov 1 '18 at 12:58







            see below xml files for further details vendor/magento/module-catalog/etc/system.xml and vendor/magento/module-catalog/etc/config.xml

            – Himmat Paliwal
            Nov 1 '18 at 12:58




















            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%2f248746%2fhow-to-add-placeholder-in-system-xml-for-custom-admin-configuration-fields-in-ma%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

            1300-talet

            1300-talet

            Has there ever been an instance of an active nuclear power plant within or near a war zone?