# Create a Record Entry Alternative to Using a QR Code Scan

> This is a way to scan an NFC to create the record entry without allowing a form to be filled out/edited (all behind the scenes). This will require an app…

Source: https://tadabase.com/docs/snippets/create-a-record-entry-alternative-to-using-a-qr-code-scan  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

![Screenshot for “Create a Record Entry Alternative to Using a QR Code Scan”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/2022-10-02-15-19-22.png)

This is a way to scan an NFC to create the record entry without allowing a form to be filled out/edited (all behind the scenes). This will require an app to write to NFC (Example: NFC Tools for Android), and then the rest is done via basic JavaScript.

> **Warning:** Under construction

**Step 1**

**In this walkthrough, I want the form to have three fields.**

1. Submitted By:
2. Location (connection field)
3. Date and Time

> **Note:** The submitted By will be a record rule of whoever is logged in. Date and time will also be a record rule to the current date and time. The Location will be the ID of the connection field.

**Step 2**

**Get the location's ID and save that value as a basic text value to the NFC chip.**

> **Note:** Make sure you write it to the card as a text value.

In my case, I have two chips (or 2 locations); one has the value of “4MXQJdrZ6v” and the other “DVWQWRNZ49.”

**Step 3**

Create a form on a page without any fields but with three rules. This is all we need to do on the form part:

![Screenshot for “Create a Record Entry Alternative to Using a QR Code Scan”](https://community.tadabase.io/uploads/default/optimized/2X/6/666e3bb913c916e039921f30cc1156c44f4f517f_2_690x359.png)

> **Note:** The key is setting the Location value to the Browser Local Storage value of ‘locationId.’

**Step 4**

**Find the Id of your component by hovering over the info icon.**

![Screenshot for “Create a Record Entry Alternative to Using a QR Code Scan”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1664739912748.png)

**Step 5**

**Add the following code to the JavaScript tab of your page.**

```
TB.render('component_X', function(data) {

    const ndef = new NDEFReader();

    async function startScanning() {
        await ndef.scan();

        ndef.addEventListener("reading", ({
            message,
            serialNumber
        }) => {

            const textDecoder = new TextDecoder(message.records[0].encoding);
            var cardValue = textDecoder.decode(message.records[0].data);

            localStorage.setItem('locationId', cardValue);
            data.ele.find('.form-submit .af-form-submit').click();

        });
    }

    startScanning();

});
```

![Screenshot for “Create a Record Entry Alternative to Using a QR Code Scan”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1664740017735.png)

**Step 6**

**You may additionally add a class to the form submit button of ‘hide’ so we don’t ever see it.**

![Screenshot for “Create a Record Entry Alternative to Using a QR Code Scan”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1664740180979.png)

**Original Community Post:**

[QR Code Scan Creates Record Entry - Community Discussions / How Do I - Tadabase Community](https://community.tadabase.io/t/qr-code-scan-creates-record-entry/1674)
