15 September 2009 at 9:26am
I have been using custom-built forms up to this point, but am interested in possibly using UserForms for client management purposes. The only drawback I have is adding dropdown fields like US states which contains 50+ items that have to be entered one-by-one. In my custom forms, i just create a class and pull in values with todropdownmap.
Is it possible to create a UserForm and push a custom field to the userForm without breaking it? I do not care that it will not show up in the admin interface list of fields, as long as it displays in the front-end form and gets written to the submission table.
15 September 2009 at 5:36pm
You can easily sub class EditableFormField to provide custom functionality. Have a look at the googlemapselectionfield module for a module which provides extra options in the UserForms - http://open/browser/modules/googlemapselectionfield/trunk/code/EditableGoogleMapSelectableField.php
So first subclass EditableFormField. You can put your sub class in its own file in your own project (eg you don't have to have it inside userforms folder for it to be loaded.
Then you would need to create a getFormField() function in that subclass which returned a dropdown field of all the states. You can see that link I posted above for some other settings you can override in your subclass