How to add placeholder in system.xml for custom admin configuration fields in magento 2
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:
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
add a comment |
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:
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
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
add a comment |
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:
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
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:
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
magento2 system.xml
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
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>
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
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%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
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
add a comment |
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
add a comment |
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
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
answered Nov 1 '18 at 13:30
Amit Bera♦Amit Bera
57.3k1474171
57.3k1474171
add a comment |
add a comment |
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
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%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
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
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