Form Builder - Drops Options with duplicate values

edited September 2016 in Bug Reports
Hi,

I am using the form builder to generate a contact form. One of the options of the form is a Select field in which in there are addresses that relate to various different things. So in the form builder they're entered like so:
email1@stuff.com:option1
email2@stuff.com:option2

If I enter options like this - so I have two options pointing to the same email address:
email1@stuff.com:option1
email1@stuff.com:option2

then the first option is dropped from the list and option the second options will be available in the form. This occurs on save. Any thoughts on why this occurs or how to solve it?

Thanks.

Comments

  • edited 10:16PM
    Are you using the forms advanced module for this and creating the form field in the CMS?
    http://docs.getfuelcms.com/modules/forms

    If so, do the option1, option2 values have spaces, commas or pipes in them?
  • edited September 2016
    Yes I'm using the advanced module and using the CMS. There is potential for the options to have spaces in but in my test cases they have not.

    On a side note: I've since tried using the enum field type instead and the issue is still present.
  • edited 10:16PM
    Hmm.. I'm having trouble replicating your issue. Are you using the latest master branch version of FUEL (1.3.2) and the latest Forms advanced module?
  • edited September 2016
    I've just checked out the latest version of fuel and done a fresh install of the form module and I have been able to replicate the issue.

    See screenshots in the following links:
    https://www.dropbox.com/s/gla4de21rjakq15/formissue1.PNG?dl=0


    Then I hit save and the following happens:
    https://www.dropbox.com/s/v0ba21az4z9jrxr/formissue2.PNG?dl=0
  • edited 10:16PM
    Those links didn't seem to display anything for me.
  • edited 10:16PM
    Apologies; it looks like the upload tool I used timed out. I've updated the original post with new links on dropbox, hopefully these persist.

    Thanks.
  • edited 10:16PM
    In that screenshot, you have options with the same key values so it will only select one.
  • edited 10:16PM
    Which function in form module controls this so it can be overwritten to allow the same keys as this is needed as it's same email but different departments
  • edited 10:16PM
    There would be potentially 2 places that you would need to change. The first would be in the fuel/modules/fuel/libraries/Fuel_custom_fields.php file keyval method. This is what parses the returned data and changes it to the JSON to be saved. The second area that would need to potentially change (if you are relying on Form_builder to render the HTML of the form), would be in fuel/modules/fuel/libraries/Form.php file which has a nested "Form_select::render" class and method.
Sign In or Register to comment.