0

In my ASP.NET MVC application, I am trying to put together a page where a user can both sign and print their name once at a workstation equipped with a Wacom. The signatures will be saved to PNGs with links in a database and then stamped in the designated area of each form, upon user approval. With just one signature canvas, the process works flawlessly.
But even with 2 separate Javascript files, I can get one canvas working fine, but cannot get the other canvas to draw.
If I split the canvases onto 2 different pages, they each work fine separately. I can do that, but would rather have them both on one page.
I know I am missing something regarding Javascript or canvas, probably simple, but I don't know what it is.
Here is the Plunker: http://plnkr.co/edit/FsFUxIFdNUyNmluLAZJn

2
Contributors
9
Replies
54
Views
3 Years
Discussion Span
Last Post by Ewald Horn
0

Thanks so much Ewald, that did it. I can't believe I didn't see that.
Now I am trying to get the "Clear" buttons to only clear their respective canvases, but each button clears both canvases.
I've tried inside anon, outside anon, in separate anons, etc..
Maybe your eyes can see something mine cannot again.
http://plnkr.co/edit/KLp3eT19QN2aUGFzh4bg?p=preview

0

Oh my - I haven't looked at that yet - I can tomorrow, it's midnight here in South Africa and I get up at 04:50am!

0

That's just fine. I can't tell you how much I appreciate another set of eyes looking at this. BTW, I hope you got some sleep...
I may be wrong, but after re-evaluating the problem, I think it is not that the "Clear" buttons clear both canvases - I think upon clicking either button, the anonymous functions reload and both canvases are reset to their initial values, which is a default blank canvas. What say you?

Edited by IndyItMan

0

I was wondering, each set of elements (canvas and 2 buttons) have their own different IDs (one for print, one for sign), and each js file is calling them by id in code. Why were they overwriting each other in the first place?

0

Hey, I got it figured out - in the Clear function, I was calling the context instead of the canvas element. Thanks again for your help, and I hope you get a nap in later (or maybe sleep in tomorrow :).

0

Yes, I don't know why there is a server error on Plunker. The code works great here, and I don't get any server issues showing up in Fiddler2.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.