ruby on rails - Pre filled, partially not editable input field with simple form? -


is possible create input field, partially filled, filled part not editable, , also, not being submitted? may seem confusing, simple example.
have field, looks url. want user specify, let's say, name, field should this:

www.something.com/users/ input

user should not able edit bold part, "input" part. also, want submit input, not whole url. need

<%= f.input :name, :not_editable_decoration: "www.something.com/users/" %> 

you can try this:

<div class="form-group">     <div class="input-group">       <span class="input-group-addon">www.something.com/users/</span>       <%= f.input :url, input_html: { class: 'form-control' } %>     </div> </div> 

the above example use bootstrap css.

you can put static url instance variable in controller.

@static_url = "www.something.com/users/"  <span class="input-group-addon"><%= @static_url %></span> 

link fiddle


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -