top of page
Lanre Olayiwola

Lanre Olayiwola

Create Custom Electronic Signature Form using Velo

  • Jan 1, 2024
  • 1 min read

Create an electronic signature on your website using Wix Code a.k.a. Velo using a custom form. No 3rd party plugins or add ons needed. Save time and money to simply create and capture an electronic signature!


Signature


// API Reference: https://www.wix.com/velo/reference/api-overview/introduction
// “Hello, World!” Example: https://learn-code.wix.com/en/article/1-hello-world

import wixData from 'wix-data';

$w.onReady(function () {

});

function validation() {
    let validationMessage = "";
    if ($w('#input1').valid && $w("#input2").valid && $w('#input3').valid && $w('#input4').valid && $w('#signatureInput1').valid) {
        saveEmployeeInfo();
    } else {
        if (!$w('#input1').valid) {
            validationMessage += "Please enter in a first name.\n";
        }
        if (!$w('#input2').valid) {
            validationMessage += "Please enter in a last name.\n";
        }
        if (!$w('#input3').valid) {
            validationMessage += "Please enter in an email.\n";
        }
        if (!$w('#input4').valid) {
            validationMessage += "Please enter in an address.\n";
        }
        if (!$w('#signatureInput1').valid) {
            validationMessage += "Please sign your name.\n";
        }
        $w('#text81').text = validationMessage;
        $w('#text81').show().then(() => {
            $w('#input1, #input2, #input3, #input4, #signatureInput1').updateValidityIndication();
        })
    }
}

function saveEmployeeInfo() {
    $w('#button1').disable();

    let theSignature = $w('#signatureInput1').value;

    let toInsert = {
        "firstName": $w('#input1').value,
        "lastName": $w('#input2').value,
        "email": $w('#input3').value,
        "address": $w('#input4').value,
        "signature": theSignature
    }

    wixData.insert("employeeform", toInsert)
        .then((results) => {
            let item = results;
            console.log(item);
            $w('#text81').text = "Your signature and information was sent in. Thank you! We will be with you shortly.";
            $w('#text81').show().then(() => {
                setTimeout(() => {
                    $w('#text81').hide();
                }, 5000);
            }).catch((err) => {
                let errorMsg = err;
            })
        })
}

function clearAllElements(){
    $w('#input1, #input2, #input3, #input4, #signatureInput1').value = null;
    $w('#input1, #input2, #input3, #input4, #signatureInput1').resetValidityIndication();
}

export function button2_click(event){
    validation();
}

1 Comment


Mình vừa có thời gian rảnh để lướt mạng và tình cờ thấy đề cập đến 79KING trong một cuộc trò chuyện. Hôm qua, mình quyết định vào xem thử để tìm hiểu thêm về nền tảng này. Mình khá ấn tượng với giao diện, nó khá bắt mắt và dễ sử dụng. Mình cũng để ý là tốc độ tải trang nhanh hơn so với một số trang khác mà mình thường hay truy cập. Tuy nhiên, có lẽ cần thêm thời gian để kiểm tra kỹ hơn về các tính năng của nó. Mình đã bookmark lại để quay lại xem kỹ hơn sau.

Like
bottom of page