1

Is there a way to show the name of the field in the front end (via Channel Form)?

There's the Name and short_name.. I want to put the whole "question" in the field Name rather than type it in the template.

Would be nice to do something like this:

<label>{FIELD_NAME}</label>
<input type="text" name="{short_name}" id="{short_name}" value="{value}">

instead of:

<label>My question here with many words</label>
<input type="text" name="{short_name}" id="{short_name}" value="{value}">

It's because I have my form in 3 templates and it would be easier to edit!

2 Answers 2

3

You could use the Instructions for your question text:

<label>{instructions:my_field_name}</label>

v2: https://docs.expressionengine.com/v2/add-ons/channel/channel_form/index.html#instructions-my-field-name

v3: https://docs.expressionengine.com/latest/channel/channel_form/index.html#instructions-my-field-name

1
  • I love this idea ! ! I'll try it soon!
    – Benoit L
    Jun 14, 2017 at 4:13
0

Depending on how many characters are in the question, you could use it as the field label when you create the custom field (or perhaps the instructions) and then output one of those in the channel form. Otherwise, a global variable might do the trick.

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.