1

CMS Joomla has a standard subform field type. How to fill in the default values in it?

Field code in XML:

<field name="field-name" type="subform"
formsource="exampleform.xml" multiple="true"
label="Subform Field" description="Subform Field Description" />

Code exampleform.xml:

<?xml version="1.0" encoding="UTF-8"?>
<form>
    <field name="example_text" type="text" label="Example Text" />
    <field name="example_textarea" type="textarea" label="Example Textarea" />
</form>

Can't find the answer in the documentation.

1
  • Thanks for joining and asking a question Alexander. Please take our tour to earn your first badge. You may also edit your profile to tell the community a bit about yourself, your work, your Joomla experience, etc. – mickmackusa Aug 14 '20 at 8:19
0

https://docs.joomla.org/Text_form_field_type

default (optional) (not translatable) is the default value.

<field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />
default="Some text"
2
  • Ok, but the form above has an attribute multiple="true" how to set for multiple lines of a form – Александр Aug 13 '20 at 19:29
  • 2
    Setting the default in exampleform.xml should load the default each time it triggers a multiple instance of the form. If you don't want the default value to be saved in the database, note that you can also use hint to show placeholder text. – Patrick Jackson Aug 14 '20 at 6:37

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.