Search code examples
ruby-on-railssimple-formzurb-foundation-6

Abide Required tag in simple-form without "data-"


With Foundation 6 and Abide I want to have this tag in a simple-form form:

<input class="string optional" pattern="text" type="text" name="service[street_address]" id="service_street_address" required>

with a required attribute.

I tried this:

<%= service.input_field :street_address, data: {:required => ''}, pattern:"text" %>

but the the required tag becomes data-required and breaks Abide validation:

<input data-required="" class="string optional" pattern="text" type="text" name="service[street_address]" id="service_street_address">

Is there any way to have only required or required="" ?


Solution

  • If required: true doesn't work, try:

    <%= service.text_field :postal_box, required: "required", pattern: "text" %>