Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Call Object Method

    I feel like this is an incredibly novice question, but I have to start somewhere.

    I have a signature applet on an html form that works just fine.
    Code:
    <head>
    <script type="text/javascript" src="ink_signatures.js"></script>
    </head>
    <script type="text/javascript">
    new sform.Signature({
            id: 'fcmsig',
            field_name: 'fcmsig',
            form_name: 'myform',
    	file_name: 'fcmsig.png',
    	caption: 'Signature',
            w: 450,
            h: 125,
            css: 'signature_area'
            });
    </script>
    What I'm having trouble with is using the "Object Method" to clear the canvas. The only information I have is to use: signature_object.reset();

    So my Clear Signature button looks like this:
    Code:
    <input type="button" data-theme="b" value="Clear" onclick="signature_object.reset(fcmsig);"/>
    I'm clueless how to correctly trigger the reset. Any help would be greatly appreciated.
    Last edited by moonpeep; 12-07-2012 at 11:24 PM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    Since you create the Signature object using (in part):
    Code:
        id: 'fcmsig',
    it is *POSSIBLE* that you would then use
    Code:
         onclick="signature_object.reset('fcmsig');"/>
    (with quotes around the id, notice!).

    But I think it is more likely that you should have done
    Code:
    var mySigObject = new sform.Signature({
            id: 'fcmsig',
            field_name: 'fcmsig',
            form_name: 'myform',
    	file_name: 'fcmsig.png',
    	caption: 'Signature',
            w: 450,
            h: 125,
            css: 'signature_area'
            });
    and then you would use
    Code:
         onclick="mySigObject.reset();"
    That is, you call methods on the object you SPECIFICALLY created.

    *********
    Without seeing the docs for "signature.js", though, it's going to be just a quess. Everybody designs APIs differently, unfortunately, so if you don't read the docs, you can't know for sure.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    moonpeep (12-08-2012)

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    HINT: If neither of the above work and you can't figure it out from the documentation, it might help if you gave us a URL link to the documentation.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Perfect!

    I used:
    Code:
    var myfcmsig = new sform.Signature({
    and then:
    Code:
    onclick="myfcmsig.reset();"/>
    Exactly what I needed. Thanks so much!
    Last edited by moonpeep; 12-08-2012 at 03:11 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •