1

I have a superTable field that I am trying to re-populate on my front-end form.

Everything is working great, I am able to populate a drop-down, but can't seem to find the magic numbers to re-populate a textfield.

<label>{{ field.name }}</label>
<input type="text" name="fields[myField][fields][{{ field.handle }}]" class="form-control" value="{{ entry.myField[0].??? }}">

This works well:

fields[myField][fields][{{ field.handle }}]

But, whatever I enter after that . Example:

value="{{ entry.myField[0].field.handle }}"

I get the error that the model "field doesn't exist". If could make field.handle just be "myField" everything would be great. I can hard-code the field name and it works great. But, I need to be able to access the values within a loop.

Thank you for any suggestions!

EDIT

value="{{ entry.myField[0].field.handle }}"

Is a plainTex field. This is the output I am trying to accomplish.

<input type="text" name="fields[myField][fields][{{ field.handle }}]" value="{{ entry.myField[0].field.handle }}">
1

The correct markup is:

{{ block[field.handle] }}

The final looks like this:

<input type="text" name="fields[myField][fields][{{ field.handle }}]" value="{{ block[field.handle] }}">
|improve this answer|||||
  • 2
    Can you post this including the for-loop expression that sets block. The code doesn’t make a whole lot of sense without. – carlcs May 30 '17 at 7:04
  • 1
    Same issue with your question btw, what is fields or field? – carlcs May 30 '17 at 7:07

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.