0

Is there a way to wrap label tags around radio and checkbox buttons. I am trying to use bootstrap inline form to make it look better but I can't find a good way to handle it.

{freeform:field:field_1 backspace="2" wrapper_open=""
wrapper_close=""
row_wrapper_open=""
row_wrapper_close="
input_wrapper_close=""
label_wrapper_open="<label class='radio-inline'>"
label_wrapper_close="</label>"}

The above code is an example of some of the ways I tried to handle this. but this gives me a clickable label tag that doesn't select anything.

<label>
    <input type="radio" name="field_1"> Field 1
</label>

Is the result I would like.

0

? You can just construct your own form, you don't need to use tags with FreeForm.

{exp:freeform:form form_name="contact" return="freeform-return/%%entry_id%%"}

<label for="first_name">
    Name
    <input type="text" name="name">
</label>

<label for="submit">
    Submit
    <input type="submit" name="submit">
</label>

{/exp:freeform:form}

This creates a valid form that submits to FreeForm and returns you to url-root.com/freeform-return/666.

Edit if that is the case (responding to your comment), why don't you use the fields as variable pairs?

https://solspace.com/docs/freeform/form/#variable_pairs

From the docs:

{freeform:all_form_fields}
<p>
    <label>{freeform:field_label}</label>
    {freeform:field_output}
    {if freeform:field_type == 'text'}hello!{/if}
</p>
{/freeform:all_form_fields}

Will this magic work for the solution you want?

3
  • The only downside to that approach is the fact that if the customer changes the value of the checkbox or adds another one I would need to manually add it to the template so I want a way to dynamically generate it using the CMS.
    – Xpertbot
    Jul 13 '15 at 19:29
  • I updated my answer.
    – jrothafer
    Jul 13 '15 at 19:49
  • Hmm, but I don't believe {freeform:field_output} includes an id attribute, which is required when using the for attribute on a label element. Jul 13 '15 at 21: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.