0

I'm using simple form for a basic login form for my site within the nav area at the top of the page.

Currently, it's spilling the form fields over two rows and no matter how many display: inline attributes I apply. It still refuses to go back onto one line. What im trying to do is restrict the number of characters in the form so that the fields fit onto one line.

Here's my current form code..

<%= simple_form_for("user", :url => user_session_path, :html => {:id => "sign_in", :class => 'form-inline' }, :remote => true, :format => :json) do |f| %>
    <%= f.input :email %>
    <%= f.input :password %>
    <%= f.submit 'Login' %>
    <%= link_to "Forgot your password?", new_password_path('user') %>
  <% end %>
4

1 に答える 1

0

簡単な方法は、入力に maxlength html 属性を使用することです。

f.input :name, :input_html => { :maxlength => x }

ただし、これは 1 つの入力に追加できる文字数を制限するだけです。これらの入力の幅に問題がある場合は、CSS を使用して入力ごとにカスタム幅を指定し、入力が 2 行目にはみ出さないようにしてください。

于 2012-05-27T19:19:49.560 に答える