2

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. Aug 14, 2020 at 8:19

1 Answer 1

1

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, 2020 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. Aug 14, 2020 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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