views:

348

answers:

0

I am trying to add a calendar date select when a user presses a button. The following code works in my partial.html.erb file:

<%= calendar_date_select_tag "due_date[#{i}]",nil,:popup=>:force,:year_range => 0.years.ago..5.years.from_now,:style=>'width:120px;'%>

But when I try to add the same code in my javascript as:

var cell3 = new_row.insertCell(0);
cell3.innerHTML = '<%= calendar_date_select_tag "due_date[' + row_number + ']",nil,     :popup => :false, :year_range => 0.years.ago..5.years.from_now, :style=>"width:120px;" %>';

There is a javascript error. But if I remove the "popup => :force" option, it again works fine, as in:

var cell3 = new_row.insertCell(0);
cell3.innerHTML = '<%= calendar_date_select_tag "due_date[' + row_number + ']",nil, :year_range => 0.years.ago..5.years.from_now, :style=>"width:120px;" %>';

What is going wrong, and how do i fix this?