Here is my text area (admin side) code :

<field id="description" type="textarea" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
     <label>Enter description here</label>
     <comment>here is comment</comment>
     <validate>required-entry validate-length minimum-length-1 maximum-length-160</validate>
     <tooltip>enter a valid description</tooltip>
    <depends><field id="pepend_id">1</field></depends>

This text area is working as expected but i want to prefill some data (not place-holder, actual text) in this text area.

I have searched across search-engines and stackexchange before posting answer and tried to use tag and few more similar tags but did not work. Can you suggest.


You can check link below to add namespace\modulename\etc\config.xml in your module to set default values for your system.xml

How to add config.xml


You can give default value to textarea field by creating config.xml file. For this you have to create config.xml file in the directory path namespace\modulename\etc\config.xml and add code as below and change "Section Name" and "Group Name" according to your system.xml file.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                <description>Textarea default text</description>
  • thanks for answering. I have tried this way but did not work. I think its because there are multiple fields in single group and we did not maintained field name/id in code. – vip Jun 21 '18 at 7:02
  • Can you paste your full system.xml code with the question? – Evince Development Jun 21 '18 at 7:36
  • Also once you have saved configuration data without config.xml file then it will not display default text in textarea. For this remove specific textarea field entry from core_config_data table. – Evince Development Jun 21 '18 at 7:44
  • @vip please upvote answer and accept it. – Evince Development Jun 22 '18 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.