How to use text_field via ajax

0

I'm trying to call via ajax a function in a textfield field, I've tried two ways: 1 - From the undefined method remote_function error.

<%= f.text_field(:data, class: "form-control", :remote => true, :onchange=>remote_function(:url=>{:action=>"fetch_duration"})) %>

2 - From the Synapse error

<%= f.text_field(:data, class: "form-control", :remote => true, :onchange=> {:url=>{:action=>"fetch_duration"}}) %>

Does anyone have an example, or link that can help me?

    
asked by anonymous 30.01.2015 / 11:40

1 answer

0

I think you have to pass the JS code to String for it to run, or a javascript function call that you implemented.

    
06.03.2015 / 00:42