How to get the value?

I wrote a small helper which receive a parameter “f”, as following:

def cno_helper(f)
concat “”
concat “<div class=‘auto_complete’ id=’” + f + “_auto_complete’”
concat
“style=‘display:none;border:none;background-color:white;height:150px;overflow:none;cellpadding:0;cellspacing:0’>”
concat “”

concat auto_complete_field( f,
      :frequency => 0.4,
      :min_chars => 2,
      :method => 'GET',
      :url=>{:action=>'autocomplete_vc_cno'},
      :tokens => ',')

end

It generate the code I want, and the auto_complete_field is working.
The program is I don’t know how to pass the current value of the input
field to the :action ‘autocomplete_vc_cno’.

Any idea? Thanks in advance.

You can send it as a :with param.

concat auto_complete_field( f,

      :frequency => 0.4,
      :min_chars => 2,
      :method => 'GET',
      :url=>{:action=>'autocomplete_vc_cno'}, :with => " 'val=' + this.value ",
      :tokens => ',')

end

Chris H. wrote:

You can send it as a :with param.

concat auto_complete_field( f,

      :frequency => 0.4,
      :min_chars => 2,
      :method => 'GET',
      :url=>{:action=>'autocomplete_vc_cno'}, :with => " 'val=' + this.value ",
      :tokens => ',')

end

Thanks a lot!

Mc Ieong wrote:

Chris H. wrote:

You can send it as a :with param.

concat auto_complete_field( f,

      :frequency => 0.4,
      :min_chars => 2,
      :method => 'GET',
      :url=>{:action=>'autocomplete_vc_cno'}, :with => " 'val=' + this.value ",
      :tokens => ',')

end

Thanks a lot!

It should be:

concat auto_complete_field( f,
:frequency => 0.4,
:min_chars => 2,
:method => ‘GET’,
:url=>{:action=>‘autocomplete_vc_cno’}, :with => " ‘val=’ +
document.getElementById(’" + f + "’).value ",
:tokens => ‘,’)

Thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs