Complicated problem with javascript

'm banging with a difficult problem I think.
I have a form like this:

  • @company.categorizations.each do |categorization|
    = f.semantic_fields_for :categorizations, categorization do
    = cat.input :classification, :as => :select, :collection
    => Classification.all,
    :member_label =>
    :classification_type, :label => false,
    :wrapper_html => { :class
    => “company_classification” },
    :input_html => { :class =>
    “company_select_classification_type” }
    - if categorization.classification
    = text_field_tag “classification_amount”,
    :class =>
    :disabled =>
    - else
    = cat.input :amount, :label => false, :wrapper_html
    => { :class => “company_classification” },
    :input_html =>
    { :class => “company_input_classification_amount” }

I hava a coffescript code that monitor the change event of the select

$(document).on “change”, “.company_select_classification_type”, ->
$div =
$.get “/classifications/find_amount”,
id: $(this).val(), (data) ->
$div.html data

when the select value change I insert in the
“.company_categorization_amount” div the code of the file find_amount:

= text_field_tag “classification_amount”, @classification.amount,
:class => “company_input_classification_amount”.

That work.
If the select value change and it is blank I want to insert
= cat.input :amount.
One for every @company.categorizations.
I don’t know how to do this.
Some help?