views:

19

answers:

1

Hi everyone

Whats the best way to disable additional html generation for date helpers in Rails?

Lets say i have a field on form <%= select_month(...) %> and it generates div class and new span inside. Is there a way to generate just the select html tag?

Of course i can generate the whole tag by myself, but just wanted to know if thats possible.

Thanks

A: 

select_month() doesn't generate any other tags beside the select tags.
For example <%= select_month Date.today %> will generate

<select name="date[month]" id="date_month">
  <option value="1">January</option>
  <option value="2">February</option>
  <option value="3">March</option>
  <option value="4">April</option>
  <option value="5">May</option>
  <option value="6">June</option>
  <option value="7">July</option>
  <option value="8">August</option>
  <option value="9">September</option>
  <option value="10" selected="selected">October</option>
  <option value="11">November</option>
  <option value="12">December</option>
</select>

Could you post the code which generates div and span tags?

Hoa
<div class="select select_on" style="width: 0px; "><select id="date_year" name="date[year]" style=""><option value="2005">2005</option><option value="2006">2006</option><option value="2007">2007</option><option value="2008">2008</option><option value="2009">2009</option><option value="2010">2010</option><option value="2011">2011</option><option value="2012">2012</option><option value="2013">2013</option><option value="2014">2014</option><option value="2015">2015</option></select><span>2005</span></div>
Dan Sosedoff
Oh, i forgot to mention. Rails version: 2.3.8
Dan Sosedoff
The code is the same as yours. For output i used <%= select_year @card.exp_year %>
Dan Sosedoff