NYCPHP Meetup

NYPHP.org

[nycphp-talk] Storing form options.

Chris Snyder chsnyder at gmail.com
Thu Jul 12 10:54:38 EDT 2012


On Wed, Jul 11, 2012 at 4:26 PM, Anthony Wlodarski <ant92083 at gmail.com> wrote:

> For example, we ask users to select their Ethnicity when filling out one of
> our forms.  This includes the values: Prefer not to say, African American,
> Asian, White, East Indian, Hispanic / Latino, Middle Eastern, Native
> American, Other.  Where would you store these options?

Where you store them is a matter of style. I like using blocks of JSON
for this, personally, but others would cringe at the parsing overhead.

But however you keep them, I think the ideal solution needs to
accommodate two things:

1) Localization/internationalization - if you're just storing American
English values, you're limiting yourself. The labels for an Ethnicity
selector can even vary region by region within the US. You may need to
keep the choices the same in order to normalize the database, but the
labels need to be translatable.

2) Meta-data about the selector itself. Multiple choice? An Other...
field? Is it ideally a <select> or a series of radio buttons /
checkboxes? Is there an instruction that goes along with the field? A
default value?



More information about the talk mailing list