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

How to make siganature-pad totally optional on a form #182

Closed radman63 closed 5 years ago

radman63 commented 8 years ago

Whenever I've used your signature pad on forms, the signature was always required. On the form I'm creating now, the signature is only required if the person is waiving medical attention. I don't see a way to make the signature optional so the form will submit without it. I see there's a way to make the typed-in name optional, which I never use, but I don't see a way to make the whole thing optional. I tried hiding the signature in a hidden div that only gets called if someone checks a checkbox, but that didn't work.

Is there a way to display the signature pad, but make it (and the typed in name both) optional? Thanks.

Regards, Bill

thomasjbradley commented 8 years ago

Yep it's possible to do that! You can use the validateFields option and set it to false.

radman63 commented 8 years ago

Thank you for your reply. I set the option as you suggested, which allowed me to submit the form without a signature, but then I received an error on the display side. It worked before I set this option. Maybe I set the option incorrectly?

The only thing I changed was adding the line regarding validateFields on the submit form. I need one form to submit the data, and another form to display it.

SUBMIT FORM:

DISPLAY FORM:

Here's the error I received on the display side:

--------- Original Message --------- Subject: Re: [thomasjbradley/signature-pad] How to make siganature-pad totally optional on a form (#182) From: "Thomas J Bradley" notifications@github.com Date: 6/15/16 4:41 am To: "thomasjbradley/signature-pad" signature-pad@noreply.github.com Cc: "radman63" bill@renegadeelectronics.com, "Author" author@noreply.github.com

Yep it's possible to do that! You can use the validateFields option and set it to false.

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

thomasjbradley commented 8 years ago

Can you send me the error you received again? It didn't show up in the message.

radman63 commented 8 years ago

I was afraid the screenshot wouldn't work. Thanks for your help with this.

Line: 18 Char: 14 Error: Syntax error Code: 0

Probably referring to the display script instead of the input script, but I'm not sure, since they are both related. If the input script is bad, it could throw off the display.

--------- Original Message --------- Subject: Re: [thomasjbradley/signature-pad] How to make siganature-pad totally optional on a form (#182) From: "Thomas J Bradley" notifications@github.com Date: 6/15/16 7:13 am To: "thomasjbradley/signature-pad" signature-pad@noreply.github.com Cc: "radman63" bill@renegadeelectronics.com, "Author" author@noreply.github.com

Can you send me the error you received again? It didn't show up in the message.

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

thomasjbradley commented 8 years ago

What about the line var sig = $$output$$? Does that get populated with something?

radman63 commented 8 years ago

I think it gets populated with the signature, so maybe there's a problem when that is empty (null)?

--------- Original Message --------- Subject: Re: [thomasjbradley/signature-pad] How to make siganature-pad totally optional on a form (#182) From: "Thomas J Bradley" notifications@github.com Date: 6/16/16 4:33 am To: "thomasjbradley/signature-pad" signature-pad@noreply.github.com Cc: "radman63" bill@renegadeelectronics.com, "Author" author@noreply.github.com

What about the line var sig = $$output$$? Does that get populated with something?

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

thomasjbradley commented 8 years ago

Yeah, that could be a possibility. Maybe check the source in the browser to see if something is there.

radman63 commented 8 years ago

Unless I'm totally misunderstanding how this works, there wouldn't be anything anywhere, because in this scenario, no one has signed the form. So, there's nothing in that element.

--------- Original Message --------- Subject: Re: [thomasjbradley/signature-pad] How to make siganature-pad totally optional on a form (#182) From: "Thomas J Bradley" notifications@github.com Date: 6/16/16 10:46 am To: "thomasjbradley/signature-pad" signature-pad@noreply.github.com Cc: "radman63" bill@renegadeelectronics.com, "Author" author@noreply.github.com

Yeah, that could be a possibility. Maybe check the source in the browser to see if something is there.

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

thomasjbradley commented 8 years ago

So the displayed signature and the signing box are on the same page at the same time?

radman63 commented 8 years ago

No. They are not on the same page. Let me explain further. You helped me out in this environment before. I am using FileBound Document Management System, and they use your signature pad. The way it works is that I have to create what you might call an external form to capture data (including the signature) and write it to their database. This is the only form that actually gets submitted.

Then, I have to create another form to display the data in their system. I spend more time on the external form and try to make it look pretty. The internal form is just a simple display of the data captured.

There are other elements on the form, but here are the signature parts of both forms. I'm not sure if the "validateFields: false" needs to be on both forms, or just the external one that gets submitted.

EXTERNAL DATA GATHERING FORM

INTERNAL DATA DISPLAYING FORM Doesn't even have to be an actual form. It just pulls in the external form elements as variables and displays them, along with static text. That's it. Thanks again for your help. --------- Original Message --------- Subject: Re: [thomasjbradley/signature-pad] How to make siganature-pad totally optional on a form (#182) From: "Thomas J Bradley" notifications@github.com Date: 6/16/16 12:55 pm To: "thomasjbradley/signature-pad" signature-pad@noreply.github.com Cc: "radman63" bill@renegadeelectronics.com, "Author" author@noreply.github.com So the displayed signature and the signing box are on the same page at the same time? - You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
thomasjbradley commented 8 years ago

Hmm... I dunno. Are you still getting the error on line 14? Does it point to your code or to signature pad?

radman63 commented 8 years ago

I'm still getting an error. The only thing I've tried so far is adding and removing "validateFields: False" from the internal display form. The error is on this line, "var sig = $$output$$;", so I'm not sure what the problem is, except that maybe it doesn't like the output to be blank? I posted a request for help on the FileBound forum page also, but have not received a reply yet. I don't know if I'm going to have to create some script to hide your script if the output is blank, or if a completely different solution is required. This is beyond me. --------- Original Message --------- Subject: Re: [thomasjbradley/signature-pad] How to make siganature-pad totally optional on a form (#182) From: "Thomas J Bradley" notifications@github.com Date: 6/17/16 1:46 pm To: "thomasjbradley/signature-pad" signature-pad@noreply.github.com Cc: "radman63" bill@renegadeelectronics.com, "Author" author@noreply.github.com

Hmm... I dunno. Are you still getting the error on line 14? Does it point to your code or to signature pad?

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

thomasjbradley commented 8 years ago

Oh, the output being blank is really interesting—that could be it. Maybe try a blank output in the example files and see if the same error is shown.

radman63 commented 8 years ago

Here is what I see when I view source on the display page.

If there is a signature drawn, I see this:

If there isn't a signature drawn, I see this:

I'll see if I can find the example files and try what you suggest. I guess I'm not really sure how this is used outside of my use in FileBound.

Regards, Bill

--------- Original Message --------- Subject: Re: [thomasjbradley/signature-pad] How to make siganature-pad totally optional on a form (#182) From: "Thomas J Bradley" notifications@github.com Date: 6/20/16 12:15 pm To: "thomasjbradley/signature-pad" signature-pad@noreply.github.com Cc: "radman63" bill@renegadeelectronics.com, "Author" author@noreply.github.com

Oh, the output being blank is really interesting-that could be it. Maybe try a blank output in the example files and see if the same error is shown.

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

radman63 commented 8 years ago

OK. I fixed it.You won't believe this. First, I used your sample files, making different versions of your sample-signature-output.js file to represent both a filled-in and a blank signature. I realized that what was really throwing the error was that when the signature pad is blank, it populated the value as a semi-colon, which "it" didn't like. I realized the semi-colon was just coming from the end of that line of script, so I just removed the semi-colon from the end of the line, and now everything works great, whether a signature is drawn or not.

In other words, I did this:

I changed var sig = $$output$$; to var sig = $$output$$ (removed the semi-colon from the end of the line)

Crazy, huh?

Thanks for your help.

thomasjbradley commented 8 years ago

Yep, totally crazy!