Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

InputMaker select field #25

Closed
bisark opened this issue May 30, 2016 · 4 comments
Closed

InputMaker select field #25

bisark opened this issue May 30, 2016 · 4 comments

Comments

@bisark
Copy link

bisark commented May 30, 2016

Because Laracogs use as label the array key and as value the array value, you could have some issue when you try to fill the options with a query on a table where there are more labels with the same values.

Eg.
(Id, name)
0, "A"
1, "B"
2, "A"

You will get from a query converted in array the follow result
["B"=>1,"A"=>2]

I think that the values should be unique over the labels.

@bretto36
Copy link
Contributor

bretto36 commented Jun 9, 2016

I have just madea pull request for this - #36
add this code in and you can add 'switch' => true, to your field array when using input_maker_create

@mlantz
Copy link
Member

mlantz commented Jun 9, 2016

My problem with this being an issue is that it's solving a problem with bad data designs not code. It's modifying the code to service a rare situation. How would the user know the difference between A and A when selecting? If either of you guys can give me a reasonable use case I'm happy to merge in the PR.

@bretto36
Copy link
Contributor

I've had issues previously where customers have added new entries into a table with the same name as a previous entry. When those items need to be selected in a drop down i find it useful to show the duplicate so the customer realises they have duplicates in their data. I can see that it is a bad data design but it can happen in the real world.
Example is a staff members name, multiple people with the same name. It's at least something that should show people they have a data issue and need to change the system to show name and email or something else that helps it be unique. I'm fine with it not being merged hopefully bisark finds it useful in his application.

@mlantz
Copy link
Member

mlantz commented Jun 10, 2016

Oh I'm happy to merge like I said I just don't want it forcing it on relationships. :)

@mlantz mlantz closed this as completed Jun 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants