thread-pond / signature-pad

A jQuery plugin for assisting in the creation of an HTML5 canvas based signature pad. Records the drawn signature in JSON for later regeneration.
BSD 3-Clause "New" or "Revised" License
727 stars 292 forks source link

Selecting canvas attempts to validate other form elements #153

Closed rushweb closed 9 years ago

rushweb commented 9 years ago

Hello Mr. Bradley. I really love your script. Nicely done!

I'm having a strange issue that I can't seem to resolve. Everytime I select (touch) the canvas, it attempts to validate my entire form. I've tried removing 'validateForm()' from my forms and set validateFields to 'false'. But for some reason, the moment I touch your signature canvas all of my field validation scripts throughout the entire form attempt to run.

Any ideas on what your script might be doing to trigger this activity?

Thanks.

thomasjbradley commented 9 years ago

Gosh, that's a weird issue—I haven't encountered it before.

Try validating your HTML, maybe there's an unclosed button tag or something that surrounds the canvas, so when it's clicked the form is actually being submitted.

rushweb commented 9 years ago

Thanks for the quick response Thomas.

Yeah, I looked for that and couldn't find it. The form actually is never submitted. The action is set to "javascript:void(0);" because all info is sent via ajax calls as the user progresses through the steps in the form.

We're a brand new startup that has been in the works for 18 months and we were supposed to launch yesterday, but this little bug has halted our launch.

I started thinking that maybe we had some Javascript that was conflicting with yours. We had a js function called "validateFields" with an "s" and yours doesn't, but we changed ours to "validateSbFields" anyway, just in case.

I know this isn't your problem, but we've got some very experienced programmers working on this and they can't figure it out.

If you're interested in taking a look for yourself, the beta site is at https://sightbox.co/browse-daily-wear-disposable-contact-lenses your signature pad is in the fifth step of the six step process.

Just FYI. I'm hoping us using your script on a commercial project like this is okay. I tried to view your license info, but the link on your site is broken. https://github.com/thomasjbradley/signature-pad/blob/master/NEW-BSD-LICENSE.txt, if you have a donate capability I would be happy to provide a little incentive to assist us with this issue :-)

rushweb commented 9 years ago

Just wanted to post a note here in case anyone else has this problem. Thanks to Mr. Bradley's awesome support, he helped us figure it out and the problem was the $('input').blur(); code that is used to force the keyboard to close if it's open on touch devices. Since we use onblur for our form field validation, it was prematurely attempting to validate every field in our form. So, we just commented out this code for our purposes and the unwanted form validation issue stopped.

Thanks soooo much to Mr. Bradley for his help figuring this out. We even offered money for his time and he wouldn't take it.

Cheers!

(P.S. - I didn't try beer. Maybe that would have been accepted.)