views:

125

answers:

1

I nave this pice of code in index.html (upload controller) This an example.

<p>
    <label for="picture_city">City:</label>
<%= form.select :city, Picture::CITIES, :onchange => remote_function(:url => {:action => 'update_universities'}, :with => '') %>
 </p>

When i go to upload/index the form loads well and no errors. But when i see generated code in html i don't see onchange attribute. It's mystic, please help me to fix that!!

<p>

    <label for="picture_city">City:</label>
<select id="picture_city" name="picture[city]"><option value="1">New York</option>
<option value="2">Boston</option>
<option value="3">Chicago</option>
<option value="4">Detroit</option>
<option value="5">Washington</option></select>
 </p>

Where is the problem??? Does anybody got it?

A: 

Properly formed select format:

select(object, method, choices, options = {}, html_options = {})

Something like that:

<%= form.select :obj, :city, Picture::CITIES, {:onchange => remote_function(:url => {:action => 'update_universities'}, :with => '')} %>
Anatoliy
it diidn't help.I still can't see onchage attribute in html source code.
Anton
please help with this code!
Anton
Maybe should use literal for naming property here?select .... :html_options => { :onchange => 'alert("asd");' }
Anatoliy
Anatoliyi don't understand what u are saing about.
Anton
Show me your updated code.
Anatoliy
i haven't got it
Anton
Tolyan I've just got it to work normally.So, thank u so your help so much.
Anton