Brantron / john_hancock

A Rails gem for custom signature form fields
MIT License
114 stars 27 forks source link

Signature Pad doesn't work upon entering page #12

Open JetEnduro95 opened 6 years ago

JetEnduro95 commented 6 years ago

When i move from a controller index page to the form page containing the signature pad, I am unable to use it unless i refresh the page.

the only other method is to 'activate' it is to enter the page by using the address bar.

Am i missing something or is there any other way to get by this?

ErikDeBruijn commented 5 years ago

@JetEnduro95 I'm guessing here, but this might be a turbolinks thing. If you turn off turbolinks it might work when navigating to the page. If this is the case, the init function should be inside a event block than normally. E.g. normally it could be loaded with this upon page load:

$(function() {
    init_signature_pad_js_stuff()
});

But with turbolinks you would need this:

document.addEventListener("turbolinks:load", function() {
    init_signature_pad_js_stuff()
});

Replace init_signature_pad_js_stuff() with the JS init function for the signature pad.