Search.../

value

Gets the value of a signature input.

Description

The value is one of the following:

  • An image, defined as a base64-encoded Data URL representing a PNG image of a signature. The value starts with the prefix 'data:image/png;base64,' followed by a base64-encoded string, for example: data:image/png;base64,iVBORw0KGgoAA...
  • An empty string if the signature pad is blank.

To reset the signature input value, call the clear() function.

To send a signature by email as an attachment, such as with a service like SendGrid, strip out the "data:image/png;base64," prefix from the value before attaching.

Type:

stringRead Only

Was this helpful?

Get a signature input

Copy Code
1let mySignature = $w("#mySignatureInput").value;
2
3/* value:
4 *
5 * data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACOCAYA...m8B/AaZVs55m1NzcAAAAAElFTkSuQmCC
6 */
Get a signature input and insert it in a collection

This example demonstrates how to insert a person and their signature in a collection called People. This collection has an image field for the signature.

Copy Code
1import wixData from 'wix-data';
2
3export function signatureSubmitButton_click(event) {
4 let theSignature = $w('#mySignatureInput').value;
5
6 let toInsert = {
7 "title": "Mia",
8 "lastName": "Casa",
9 "email": "MiaCasa@SuCasa.com",
10 "signature": theSignature
11 };
12
13 wixData.insert("People", toInsert)
14 .then((results) => {
15 let item = results; //see item below
16 console.log(item);
17 })
18 .catch((err) => {
19 let errorMsg = err;
20 });
21}
22
23/* item:
24 *
25 * {
26 * _id: "41c8ef87-3eec-47bd-a3bd-17a09de9ffee"
27 * _owner: "4c47c608-cfa8-4037-93ac-738f09560ed3"
28 * _createdDate: "2019-11-10T09:27:14.605Z"
29 * _updatedDate: "2019-11-10T09:27:14.605Z"
30 * title: "Mia"
31 * lastName: "Casa"
32 * email: "MiaCasa@SuCasa.com"
33 * signature: "data:image/png;base64,iVBORw0KGgoAAAANSUhEU...AAAASUVORK5CYII="
34 * }
35 */
36