Documentation

What is the installation process?

First copy all package files to your site. They are:

Finally, in the Head part of your site include both javascript sources:

Being [JS_PATH] the actual path to these two files.
Now we are ready to go!!

How to insert a widget?

A widget can be used as an editor or just as a viewer. They are very similar, so lets look at both:

Editor

First you need a something like a Div to serve as placing tag for the widget. So, just add a Div with an Id of your choice:

Then, you need to place a Hidden Field to which the widget will export the SVG. Don’t forget to put this field inside the desired Form:

Don’t disregard that this field needs to have an Id also.
Finally, you need to create our widget using javascript. Just need to instantiate our widget passing both Id’s and a few more info that we’ll discuss later.

Both javascript libraries will take care of the rest and load the widget when the page is finally loaded, this is, they will automatically add some code to the Body Onload event. By default, the widget source will be also its repository, in this casa, the hidden field. So, if you fill the hidden field, it will appear in the widget as it starts.

Viewer

The only difference between this and the editor is that you don’t provide an “id” in the javacript InputDraw Class instantiation options. So, you will to have to define a source for the viewer.
There are three types of source: Passing a field Id, an Url or directly SVG content. Note that this is also possible to do in the editor.

InputDraw: javascript class – How does it work?

Next we will present the various parameters of this class constructer. InputDraw takes three parameters. First is the actual path of the flash file; just indicate the file in your site. Second is the placement Id, which is normally the Id of the Div created to hold the widget. Finally, there are and hash of options. They are:

The source precedence is “src_id” > “src_svg” > “src”. If none is set, then it will be “id”

What else can I do ?

There are some more options to do fun and nice to have stuff:

And for Ajax calls ?

If you are using Ajax, the Onload of Body won’t be called, so just put the following javascript command on complete or in a javascript tag in the end of the content: