1

I would like to get the label and checkbox inline using composer.

This is the current code rendered by the {composer:field_output} tag:

<div class="unit size1of1">
  <label for="freeform_newsletter">
    Newsletter
  </label>
  <p>
    <input type="hidden" name="newsletter" value="n">
    <input type="checkbox" name="newsletter" value="y" id="freeform_newsletter">
  </p>
</div>

But I'd like it to render something like this, still using the {composer:field_output} tag while selecting all items containing checkboxes:

<label  for="freeform_newsletter" class="checkbox-inline">
  <input type="hidden" name="newsletter" value="n">
  <input type="checkbox" name="newsletter" value="y" id="freeform_newsletter"> Newsletter
</label>
1

You'd have to manually write that out instead of use the composer tag.

1

This snippet should do it.

{if composer:field_type == 'checkbox'}
    <label{if composer:field_name != ''} for="freeform_{composer:field_name}"{/if} class="checkbox-inline">
        {if composer:field_required}
            {freeform:field:{composer:field_name} attr:required="required"}
        {if:else}
            {freeform:field:{composer:field_name}}
        {/if}
        {composer:field_label}{if composer:field_required}<span class="required">*</span>{/if}
    </label>
{if:else}
    {if composer:field_required}
        {freeform:field:{composer:field_name} attr:required="required"}
    {if:else}
        {composer:field_output}
    {/if}
{/if}

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.