James,

The include_blank option worked. Here is what I did for the date field
where I added  :include_blank => true

<def tag="input" for="date" attrs="order">
  <% order = order.nil? ? [:month, :day, :year] : comma_split
(order).*.to_sym -%>
  <%= select_date(this || Time.now, attributes.merge(:prefix =>
param_name_for_this, :order => order, :include_blank => true)) %>
</def>

For enum string: I simply add an attribute called blank.

<def tag="input" for="HoboFields::EnumString"
attrs="labels,titleize,blank">
  <% labels ||= {} %>
  <% titleize = true if titleize.nil? %>
  <select name="#{param_name_for_this}" merge-attrs>
  <%= "<option value=''/>" if blank.nil? %>
    <%= options_for_select(this_type.values.map {|v| [labels.fetch
(v.to_sym, titleize ? v.titleize : v), v] }, this) %>
  </select>
</def>

* I do have one more question: How would I include a blank field where
belong_to field in the edit form? For ex: License belongs_to client:
On the license New page, the NO client as option displayed on the drop
down; however, there is no blank option displayed when you are in Edit
page.

Best Regards,
Sean




On Dec 18, 3:07 am, James Garlick <[email protected]> wrote:
> Input for date is a wrapper over the rails helper select_date, so in  
> theory it should be possible to
> use the include_blank option like this: <input include-blank/> but I  
> haven't tested it myself. Let me
> know if it works.
>
> For enum string there is no built in support but it shouldn't be that  
> difficult to modify it.
> Just take the definition of "input for HoboFields::EnumString" out of  
> rapid_forms.dryml and put it in
> your application.dryml, then modify it to take another attribute like  
> "include-blank" and if that is true
> then prepend the blank field to the options.
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to