views:

35

answers:

0

Not sure why this is not working...

I have a collection_set as below

<%= collection_select(:entry, :entry_status_id, EntStatus.find_all_draft_or_edit, :status, :en_desc, {}, { :onchange => "change_editor_select_visibility('entry_set_editor', this.value)" }) %>

When I load the form, I want to set visibility on another div based on the value of this collection set. I am calling the below function from my onload function but there seems to be no effect.

function disp_entry_editor_visibility(){
    if (document.getElementById('entry_entry_status_id').value == 1) {
        document.getElementById('entry_set_editor').style.display = "none";
    }
}

Confirmed the id in the html sent to the browser...

<select id="entry_entry_status_id" name="entry[entry_status_id]" ....