0

I am trying to set a default value for the repeatable custom field. My subform has a number field, a media field and a text field.
I am using the default value field in the repeatable field configuration like this :

repeatble filed subform with default value

And this is what I tried for the default value :

"type":"2","Fichier":"images\/blog\/test.jpg","Description":"Default description"

I am somehow not getting the syntax right or maybe not using the right approach for this.
My aim is to have values already filled with content when adding new subforms while editing the articles here :

enter image description here

  • Can you not use default="xxxx" like you'd normally use for form fields? – Lodder Jul 24 at 7:33
  • @Lodder no, that doesn't work. I tried the value stated in my question because that is what the rawvalue element returns when a field has been entered. – web-tiki Jul 24 at 15:24
  • Can you share your code please? – Lodder Jul 24 at 15:28
  • @Lodder I haven't coded anything in the backend. I am just using custom code to display the field values in a template overide. default="xxxx" works fine for the other custom fields (non repeatable text for example) – web-tiki Jul 24 at 16:04
  • It would need to be in json format, try: {"type":"2","Fichier":"images\/blog\/test.jpg","Description":"Default description"} – tonypartridge Jul 25 at 22:39
0

So you would need to change it to be json and array based. Here is a rough example I setup as a default field which works as expected:

{"test0":{"type":"2","Fichier":"images\/joomla_black.png","Description":"assasa"}}

test0 is the in two parts, test is the name of the field and 0 is the field of the repeatable field.

the rest of it you can see matches similarly to what you have.

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.