top of page

One-Way-Ticket

CLOSE.png

You have already filled the form!

CODE
Submit

One-Way-Ticket

import wixData from 'wix-data';

import wixUsers from 'wix-users';

 

var userID, userEmail

 

$w.onReady(function () { getUserInfo() });

 

export function button1_click(event) {check_User()}

 

// This function will check, if the user is is already in your database (already has filled the form once).

function check_User (parameter) {console.log("Check-process started.")

    wixData.query("OneWayTicket") //<---------- here the name of your DATABASE

    .eq("title" ,userID) //<---- choose here the right reference-field (colum) do not touch userID.

    .find()

    .then( (results) => {

        if(results.items.length > 0) {console.log("USER-Found in DATABASE")

            console.log(userID)

            console.log(userEmail)

            $w('#box1').show()

            //here your code............. if user has already filled the form once.......

 

        } else {console.log("This USER do not exist yet in your DATABASE.")

 

            //here your code............. if user has never filled the form.......

            

            //Saving process to save the new user in DATABASE

            let toInsert = {

            "title":       userID,

            "firstName":   $w('#input1').value,

            "lastName":    $w('#input2').value,

            "eMail":       $w('#input3').value,

 

            };

            wixData.insert("OneWayTicket", toInsert)

            .then( (res) => {

                console.log(res.items)

                console.log("New User-Data saved.")

 

                // here your CODE to disable BUTTON after the user was added to the DATABASE.

                $w('#button1').disable()

                $w('#input1').value = ""

                $w('#input2').value = ""

                $w('#input3').value = ""

 

            } )

        }

    } )

    .catch( (err) => {

 let errorMsg = err;

    } );

}


 

// This function will get Users-Informations (ID / e-Mail / log-in-state / )

function getUserInfo (parameter) {

    let user = wixUsers.currentUser;

    userID = user.id;          

    let isLoggedIn = user.loggedIn;

    user.getEmail()

  .then( (email) => {

    userEmail = email;     

  } );

  console.log("User-Info loaded.")

  console.log("-----------------")

}


 

export function close_click(event) {

    $w('#box1').hide()

}

Comment-Box

CLOSE.png

Version-1.0

Under_Construction.png

Leave a comment. . .

Arrow.png

General-Settings

ON                 OFF

Show Text-Length

ON                 OFF

max. Text-Length

ON                 OFF

Show Key-Press

ON                 OFF

Show Key-Code

ON                 OFF

Show Total-Count

Character-limit

Load default settings
Save
mr-money-man 00:22:20

You can use also the CHAT if you want

 

8.8.2020
mr-money-man 00:22:01

Welcome back on my site ^^

8.8.2020
barbarabessals2 19:21:42

hello!

07/08/2020
mr-money-man 23:52:46

Hello Barbera ^^

7.8.2020
arthurvalatin 07:33:29

hello

04/08/2020
russian-dima 00:15:35

You can also set your own CHARACTER-LIMITATION in the SETTINGS but at moment 240
-characters are the max.

30.7.2020
arthurvalatin 07:13:39

hello!

30/07/2020
russian-dima 00:11:43

PRESS "TAB+ENTER" and you will see how it works without the button xD

30.7.2020
russian-dima 00:10:23

For example it is possible to send messages without to click everytime with the
mouse onto the button xDD

30.7.2020
russian-dima 00:09:45

You will find a lot of hidden intergrated stuff in my little comment/chat-tool ^
^

30.7.2020
arthurvalatin 07:09:33

Hello!

30/07/2020
russian-dima 00:08:44

Check it out! It almost works like a CHAT-BOX

30.7.2020
Seite 1 von 1
Design
Settings
About
CLOSE.png
Leave a comment, or start a chat.

Post-Comment

- - -

Pressed-Key

- - -

Key-Code

Text-Length

- - -

max. Text-Length

- - -

Number of Comments

- - -

designed & developed by russian-dima

Write a comment
bottom of page