How to populate a select list.

I'm creating a simple 'Yes/No' select droplist. I thought the select tag accepted a hash. But, it doesn't show any items when I view it. This is the code in Markaby 0.5.

select_tag( 'work_order', 'warranty_work_ny',{"Yes" => "Y", "No" => "N"})

There must be an obvious error in there somewhere, I'm just not seeing it.

a bad idea.

For a boolean state object I suggest one of two approaches.... 1. A checkbox or 2. two radio buttons.

In your case, it sounds like you really need to put in a checkbox

I use the radio button approach when the states match to a small set of mutually exclusive states that don't neatly map to a true/false. Things like 'gender' are a good example.

_Kevin

I'm creating a simple 'Yes/No' select droplist. I thought the select tag accepted a hash. But, it doesn't show any items when I view it. This is the code in Markaby 0.5.

select_tag( 'work_order', 'warranty_work_ny',{"Yes" => "Y", "No" => "N"})

There must be an obvious error in there somewhere, I'm just not seeing it.

select_tag takes: name for params, options for popup, html options. So you have an extra argument slipped in there, and you should really use options_for_select to build the options string. try:

select_tag(:warranty_work_ny, options_for_select({"Yes" => "Y", "No" => "N"}))

(typed into mail, apologies in advance for the errors)

From a user interface perspective, a 'select' for a yes/no question is a bad idea.

From the survey design PoV, any binary (Yes/No) question has four possible and appropriate responses:

Yes; No; Don't know; not applicable.

Plus also:

Not Answered.

For a boolean state object I suggest one of two approaches.... 1. A checkbox or 2. two radio buttons.

In your case, it sounds like you really need to put in a checkbox

I use the radio button approach when the states match to a small set of mutually exclusive states that don't neatly map to a true/false. Things like 'gender' are a good example.

Most binary survey questions fall into the same camp. From the UI perspective, popups/dropdowns are biased towards the first option, the one that shows by default.

Paul