The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Option Lists - Built from values in database table - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Option Lists - Built from values in database table (/showthread.php?tid=1677) |
Option Lists - Built from values in database table - apothegm - Oct 7th, 2011 Is it possible to have option lists built from value pairs in the database table? This would make it more dynamic. For example - I'd like to have a list of companies and codes in a table and have a drop-down in my form with the list of companies and return the codes as a value. That list of companies/codes would also have a form that could so that list can grow or change. RE: Option Lists - Built from values in database table - Ben - Oct 7th, 2011 Interesting. Sort of, yes...! With FT 2.1.0+ when you create a radio, checkbox, dropdown or multi-select dropdown, you have the option to specify *either* an Option List as the data source for the field, or the contents of a separate form field (but on from a different form). To do this, just edit the field on the Edit Form -> Fields tab, and go to the second tab in the dialog window that appears. There, in the Option List / Content field, pick the form field. So you could create a form #1, that has an "event" field. Then in the second form, target the contents of that form field for the dropdown field (or whatever). Then the content of that dropdown would always reflect what's in that other form. It's dynamic, but pretty limited. Plus it only pulls from a single form field - and it has to be in a separate form. So it's definitely not perfect, but it may help for certain cases. Any use? - Ben RE: Option Lists - Built from values in database table - apothegm - Oct 7th, 2011 Oh cool, I didn't realize you could reference another form field for a dropdown. My only issue here - you've already pointed this out - is that I can't pick two fields. One for the value, and the other for the display text. For example - "C" as the value and "Commercial" as the display text for the dropdown. I'm currently using VFront (another php/mysql form/database webapp) but it has its' own issues - it doesn't appear to be actively developed and much of the code is in Italian which is frustrating. But I like some of the form building features - such as integrated validation and key-value pairs for dropdowns. When I found Form Tools - I was pretty excited to find an alternative that's being updated regularly. Perhaps using the option lists won't be a huge deal. I'll have to take a closer look at the validation options though. It's kinda strange the way FormTools allows you to add a record before you update it - leaving all the form fields blank. RE: Option Lists - Built from values in database table - Ben - Oct 10th, 2011 Hey, Cool, hope it works out! Quote:It's kinda strange the way FormTools allows you to add a record before you update it - leaving all the form fields blank. Interesting... I thought this just kind of made sense, myself, but now that you mention it I can see that being a bit weird. But the fact that it says "your record has been created" (or whatever) at the top of the page, should at least be clear to the user what just happened. If they decide not to keep it, they can always just clicked the "Delete" button at the bottom of the page (assuming it's available for that View). - Ben RE: Option Lists - Built from values in database table - apothegm - Oct 10th, 2011 (Oct 10th, 2011, 11:00 AM)Ben Wrote:Quote:It's kinda strange the way FormTools allows you to add a record before you update it - leaving all the form fields blank. With the custom fields premium module - if I set all the fields to required - will it prevent adding a record with empty/null fields? Also - can validation be added to Form Tools core short of adding on the Custome Fields module? It looks like in order to use your RSV or PHP validation scripts - I would need to use the API version of Form Tools. Am I understanding this correctly? RE: Option Lists - Built from values in database table - Ben - Oct 11th, 2011 Hi apothegm, Sure! You don't actually need the module: validation now comes included in 2.1.4 - you just need to upgrade to get access to that feature. The validation options are pretty basic, but all field types do offer the "is required" validation rule. But just to clarify: the validation added in 2.1.4 is only "automatic" for forms within the Form Tools interface. You'll still need to add it to your external forms separately. Quote:It looks like in order to use your RSV or PHP validation scripts - I would need to use the API version of Form Tools. Am I understanding this correctly? Pretty much. The RSV library can be added to either POST or API forms, but the PHP validation needs your form to be an API form. Here's a little more info, in case you haven't stumbled across it: - on the 2.1.4 validation: http://docs.formtools.org/userdoc2_1/index.php?page=field_validation - on adding validation (JS + PHP) to your forms: http://docs.formtools.org/tutorials/php_validation/ http://docs.formtools.org/tutorials/js_validation/ Let me know if any of this isn't clear. Last week I sat back and looked over the whole script and it's pretty clear that the vast majority of confusion is surrounding integrating external forms with Form Tools. Once the Form Builder module is released, I think it'll go a loooooong way to simplifying things for people! ![]() - Ben |