Form Builder is currently hardcoded to allow a maximum of ten items to be added via the 'options' property (e.g., for select lists).

Is there a reason for that limit? It seems low, and there are lots of legitimate use cases where people might want to add more.

The attached patch ups the limit to 100, which ought to give plenty of breathing room for legitimate use cases.

Comments

quicksketch’s picture

It's not "hard-coded" at 10, that's just the default. You can always set #limit to a higher number when sending your element to form builder before editing. Although 10 does seem a bit low even for a default. I'll put this in next time I'm working on form builder.

David_Rothstein’s picture

You can always set #limit to a higher number when sending your element to form builder before editing.

Can you? This one doesn't check isset($element['#limit']) for a default value like it does for #key_type and the other surrounding properties... Maybe it should as part of this patch?

Anyway, I guess I meant more that it's hardcoded from the site administrator's perspective. Whatever the #limit is, they are stuck with it, so it's good to use a large value.

Thanks!

quicksketch’s picture

Status: Needs review » Fixed

Hm, well let's ponder that issue separately. This patch is definitely logical as-is. If it turns out the #limit is not configurable in any way, we'll fix that one separately Thanks! (Committed)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

enrique.delgado’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new1.04 KB

I have a use case where I need to add a drop-down list with a list of countries. We have about 196 countries (http://geography.about.com/cs/countries/a/numbercountries.htm) so a limit of 100 wouldn't account for that. I'm using the Form Builder module with Webform, via the Form builder Webform UI module.

Even if I temporarily disable Form builder Webform UI, add the options list, and then re-enable it, the Form Builder does not recognize the new field and making any changes to the form components deletes the drop-down list I was able to create while Form builder Webform UI was disabled.

Shall we up the limit to 255 or something like that? Or should the change be done on the Webform module (in this case, the module that is using Form Builder)?

enrique.delgado’s picture

StatusFileSize
new893 bytes

Please ignore the last patch, review this one instead.

enrique.delgado’s picture

Any updates on this request? :-] Does it make sense?

quicksketch’s picture

Hi Enrique, thanks for the updates and the patch. I think setting the limit higher is probably acceptable. The limit there is mostly to prevent overloading the DOM with a huge number of elements. This can probably be committed, but I'd like to figure out if Form Builder Webform module can set this value manually (or if it can be set through hook_form_alter()) before changing the value again. For now I think it's safe for you to assume this patch will be included the next time I'm going through the queue for patches.

enrique.delgado’s picture

Cool, thanks!

quicksketch’s picture

Issue summary: View changes
Status: Needs review » Closed (duplicate)