date enable disable

Posted by Newbie on Stack Overflow See other posts from Stack Overflow or by Newbie
Published on 2012-08-29T02:54:27Z Indexed on 2012/08/29 3:38 UTC
Read the original article Hit count: 92

Filed under:
|

I have an "add new product page" and I have a field in the database table "jos_stockmovement", "start_week" which contains data for the year and week.

In my "Add New Product" page I have a field dropdown-list named "Start Week" which holds the year and week, for example, "2012/36".

How do I disable the past week? I all I want to enable is the current week.

Heres my code:

<td colspan="99">
  <%= fld.select :start_week, options_for_select(
    StockMovement.order("year DESC, week DESC").map { | val |
      [ "#{ val.year }/#{ val.week }", val.id ]
      },
      :selected => @product.start_week
    ),
    :class => "ddl_SW"
  %>
</td>

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby