How to get data from input field using ruby on rails -


how data html text field , use in ror?

for example, let's enter word in text field , ror prints how many characters in said word.

best way using javascript insist ror use observe_field

<%= text_field  :users, :word, :value=>'',  :autocomplete=>'off' %><br> <span id="word_message" style="color :red; font-size: 9px;"></span> <%= observe_field  :users_word,  :url => {  :action =>  :word_length,  :id=>1 },                :on=>"blur",                :frequency => 0.25,                :with => "'word='+value" %> 

in controller

def word_length   word = params[:word]   render :update |page|     page.replace_html  'word_message', "#{word.length} characters"   end end 

Comments