# Unable to observe select\_tag's value

**URL:** <https://www.ruby-forum.com/t/unable-to-observe-select-tags-value/162958>\
**Category:** Rails\
**Created:** [March 16, 2009, 7:09am UTC](https://www.ruby-forum.com/t/unable-to-observe-select-tags-value/162958 "2009-03-16T07:09:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahil\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@Sahil\_D](https://www.ruby-forum.com/u/Sahil_D)\
**Post date:** [March 16, 2009, 7:09am UTC](https://www.ruby-forum.com/t/unable-to-observe-select-tags-value/162958/1 "2009-03-16T07:09:16Z")

</div>

Hi,

I am trying to observe a select\_tag’s value, and insert a partial inside  
the  
page based on that value. Here’s the code:

#index.html.erb  
\<% form\_tag do %\>  
\<%= select\_tag ‘product\_id’,  
options\_from\_collection\_for\_select(@products, ‘id’, ‘pro\_name’), {:id  
=\> ‘product\_id’} %\>  
\<%= select\_tag ‘taxation\_id’,  
options\_from\_collection\_for\_select(@taxations, ‘id’, ‘tax\_name’), {:id  
=\> ‘taxation\_id’} %\>  
\<%= observe\_field ‘product\_id’, :url =\> {:controller =\>  
‘regulations’, :action =\> ‘show’}, :with =\> “‘id=’ + value” %\>  
\<% end %\>

#regulations\_controller.rb  
def show  
@regulation = Regulation.find\_by\_product\_id params[:id]

```
respond_to do |format|
  format.html # show.html.erb
  format.xml { render :xml => @regulation }
  format.js
end

```

end

#show.js.rjs  
page.alert(“you are here!”)  
page.insert\_html :bottom, ‘regulations’, :partial =\> ‘all’, :locals =\>  
{ :regs =\> @regulations }

Index.html looks like this:

 joomla VAT 

Is something missing or wrong in the above code? even the alert is not  
getting called.

Regards

–  
Sahil
