driftingruby / 017-dependent-fields-rails

Using unobtrusive javascript, we can hide certain fields on forms based on the selected values of other fields.
https://www.driftingruby.com/episodes/dependent-form-fields
0 stars 0 forks source link

Turbolinks = false?? #1

Open MincePie opened 8 years ago

MincePie commented 8 years ago

Hi, I'm trying to set this up (and totally stumped). The only thing I can think of is that I have turbo links set to false (because I use olark). Can DFR work without turbo links? If so, I need to look elsewhere for my problem.

kobaltz commented 8 years ago

This absolutely can work wit or without turbolinks. This gem is really a container for a javascript file that can be found at https://github.com/vollnhals/dependent-fields-rails/blob/master/vendor/assets/javascripts/dependent-fields.js.coffee

You may need to wrap the bind for DFR on the page:load event like this

        $(document).on('ready page:load', function() {
            DependentFields.bind();
          });

What issues are you having with it not working?