Skip to content

form builder tag #1

@tamagokun

Description

@tamagokun
{% for part in site.fridge.types.request_quote_product.parts %}
    {% capture name %}products[][{{part.name}}]{% endcapture %}
    <div class="field-{{part.name}}">
      <label>{{part.label}}</label>
      {% case part.type %}
        {% when "text" %}
          <input type="text" name="{{name}}" placeholder="{{part.hint}}"  {% if part.required %}required{% endif %}>
        {% when "textarea" %}
          <textarea name="{{name}}" placeholder="{{part.hint}}"></textarea>
        {% when "radio" %}
          {% assign choices = part.choices | fridge_choices %}
          {% for choice in choices %}
            <p>
              <label class="radio">
                <input type="radio" name="{{name}}" value="{{choice.key}}"> {{choice.value}}
              </label>
            </p>
          {% endfor %}
        {% else %}
          <input type="{{part.type}}" name="{{name}}" placeholder="{{part.hint}}" {% if part.required %}required{% endif %}>
      {% endcase %}
    </div>
{% endfor %}

TODO

  • - support all part types (uploads will be tough...)
  • - utilize Fridge's public creation API endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions