dependent-fields-rails icon indicating copy to clipboard operation
dependent-fields-rails copied to clipboard

Make select2 optional and uncheck hidden fields

Open chancedowns opened this issue 10 years ago • 3 comments

I didn't see any dependencies on select2, so I added a check for it.

I also have a requirement to reset/uncheck any checkboxes in the hidden dependent fields. I wasn't sure if this is something you would want or if there's some more customizable way to allow it, so I'm open to any suggestions.

Lastly, I can break these into 2 separate pull requests if you want.

chancedowns avatar Aug 21 '14 02:08 chancedowns

Thanks for the pull request. I will merge the first commit if you split it out into a seperate pull request. I also would consider the second one if unchecking was configurable.

vollnhals avatar Sep 02 '14 08:09 vollnhals

I pulled the first commit out into https://github.com/vollnhals/dependent-fields-rails/pull/10

As for the uncheck, what would you suggest to make it more configurable/usable? Maybe some type of reset config/data-attribute? Would you want to maybe persist the original value and reset it back to that, or is that making it too complicated?

chancedowns avatar Sep 02 '14 12:09 chancedowns

After thinking about it, I think the best way would be to restore the original input states. So instead of just unchecking as you do now, I would reset each input to its original value.

The reset functionality itself would need a flag, so that the default of just hiding remains.

vollnhals avatar Sep 05 '14 13:09 vollnhals