0

I have a ready html layout. It look like this(!SLIM USING!):

label.modal__form-label Имя
input.modal__form-control type="text" required="" minlength="3"

Its generate this code:

<label class="modal__form-label">Имя</label>
<input class="modal__form-control" minlength="3" required="" type="text">

That's what I need.

I pasted my rubycode instead this. Ruby code:

= f.input :name, input_html: { minlength: "3", type: "text" }, required: true

And get this one html:

<label class="string required" for="feedback_name"><abbr title="required">*</abbr> Name</label>
<input class="string required modal__form-control" minlength="3" type="text" required="required" aria-required="true" name="feedback[name]" id="feedback_name">

So as U see, I need to give a class to label and rename :name into "Имя" in simple form. How can I do this?

1 Answer 1

1

label and label_html should be the additional options that you're looking for. So putting it all together:

= f.input :name,
          input_html: { minlength: "3", type: "text" },
          label_html: { class: "modal__form-label" },
          label: "Имя",
          required: true
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.