nicklockwood / FXForms

[DEPRECATED]
Other
2.93k stars 339 forks source link

Dynamic enum? #446

Closed internalG closed 8 years ago

internalG commented 8 years ago

All samples in code of multiple selections are fixed. Do we have any option to enable user to enter new items besides table checks. What about user's interests are not listed?

nicklockwood commented 8 years ago

I'm not sure I understand, but have you looked at the Dynamic Forms example? It shows how to build forms from json instead of a fixed structure.

internalG commented 8 years ago

I mean the enum filed that user can input a new value. For example, the language field we only list @"English", @"Spanish", @"French", @"Dutch". How can I enable the user to input the Chinese as a new value?

nicklockwood commented 8 years ago

Oh I see. There's no built-in control for that yet. You could do it with a template field, but you'd need to create a custom field type that includes both a text input and a tick for selection.

nicklockwood commented 8 years ago

It might be easier to go the route of having an "other, please specify" option in your enum, and then having an optional text field that is shown only when "other" is selected.

You could also just have a separate text field for entering a new value which then modifies the source array for the selection in your data model, and reloads the form.

internalG commented 8 years ago

Thanks. It seems the FieldController is the way to go.