Storing data collected from a Google form into an Excel spreadsheet

I have created a form using table layout. My goal is to automatically shift the focus to the next input field once the current one reaches its maximum length. I tried implementing this functionality with jQuery, but it only seems to work with inputs and not with td elements. Here is the code snippet I used:

$(".inputs").keyup(function () {
    var index = $('.inputs').index(this) + 1;
    $('.inputs').eq(index).focus();
});

Below is the HTML code for the table:

<form>
   <table>

        <tr>

            <td class="custom_header">First Name* </td>
            
            <!-- Add more input fields here -->

         </tr>
   </table>

</form>

Is there a way to submit this form as a Google Form considering it contains multiple input fields?

Answer №1

Consider using the tabinex attribute within the <input /> tag. Here is a functional example:

<form>
        <table>
            <tbody>
                <tr>
                    <td>
                        <input tabindex="0" class="input" type="text" maxlength="1"  required/>
                    </td>
                    <td>
                        <input tabindex="1" class="input" type="text" maxlength="1"  required/>
                    </td>
                    <td>
                        <input tabindex="2" class="input" type="text" maxlength="1"  required/>
                    </td>
                    <td>
                        <input tabindex="3" class="input" type="text" maxlength="1"  required/>
                    </td>
                    <td>
                        <input tabindex="4" class="input" type="text" maxlength="1"  required/>
                    </td><br />
                    <td>
                        <input tabindex="5" class="input" type="text" maxlength="1"  required/>
                    </td>
                    <td>
                        <input tabindex="6" class="input" type="text" maxlength="1"  required/>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script>
    $(document).ready(function() {
        $('.input').on('keyup', function(e) {
            var input = $(this), 
            nextInput = $('input[tabindex="' + (Number(input.attr('tabindex')) + 1) + '"]');

            // If current input value reaches maximum limit and there is a next input, focus will shift to it.
            input.val().length == input.attr('maxlength') && nextInput.length && nextInput.focus()
                });
                });
    </script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to test a React component that includes a Router, Redux, and two Higher Order Components using Jest and Enzyme?

I'm currently facing a challenge with this issue. I have a React Component that is linked to React Router 4 and Redux store, and it's wrapped by two HOCs. It may sound complicated, but that's how it was implemented. Here's the export st ...

Incomplete Website Encryption Alert

Currently, I am developing a website called "usborroe.com" and have just set up a GeoTrust Business ID SSL Certificate. However, despite my efforts to ensure full encryption on the site, an error message is indicating that it is not fully encrypted and t ...

Tips for ensuring your jQuery events always trigger reliably: [Issues with hover callback not being fired]

My background image animation relies on the hover callback to return to its original state. However, when I quickly move the mouse over the links, the hovered state sticks. I suspect that I am moving the mouse off before the first animation completes, caus ...

Performing numerous asynchronous MongoDB queries in Node.js

Is there a better way to write multiple queries in succession? For example: Space.findOne({ _id: id }, function(err, space) { User.findOne({ user_id: userid }, function(err, user) { res.json({ space: space, user: user}); }); }); It can g ...

Prevent request timeouts in Express.js

I am currently experimenting with methods to terminate client requests that are prolonging excessively, thus depleting the server's resources. After reviewing various sources (referenced below), I attempted a solution similar to the one suggested here ...

Navigate to a specific position with a single click by accessing a class from another Vue component

Clarification of the issue When a user clicks on the login link, the view should automatically scroll down to the login window where they can input their credentials. I know how to achieve this in a single file using document.getElementById('login-w ...

Fetching the name of a JSON object in JavaScript converted to a string

Is there a way to retrieve the name 'muxEnvironments' as a string from the object? I need it in order to analyze and compare the content type. When I use console.log(obj), the entire object is displayed. My objective is something like this: jso ...

Ways to determine the height of a responsive div's background image

I have a container with a background image. Inside this container, there are additional elements like my navigation bar. My goal is to make the container have the same height as the background image. I've attempted the following: .bg { ...

Upon attempting to start the server, the module 'express-stormpath' could not be located

Upon trying to execute node server.js (in a regular terminal without superuser or root permissions), the following error is thrown: alphaunlimitedg@AUNs-PC:~/my-webapp$ node server.js module.js:442 throw err; ^ Error: Cannot find module 'expr ...

What could be causing issues with angularjs ng-include not functioning properly in Chrome at times?

<html ng-app="myApp1"> <head> <title>NG-Include</title> <script src="angular.js"></script> <script src="filter.js"></script> </head> <body> <div ng-controller="myController"> ...

Creating Event Handlers for corresponding elements in HTML with the help of JQuery and JavaScript

Struggling with HTML and debugging an issue in my ASP.NET Core App. The problem lies in a CSHTML view that functions as a timeclock system for tracking user input against job numbers. The current Index.cshtml is operational, verifying JobNumbers against t ...

Using Fabric.js to manage image controls situated beneath another overlay image

I'm currently working on a canvas user interface using jquery and the fabric.js library. I managed to add an overlay png image with transparency by implementing the code below: var bgImgSrc = bgImg.attr('src'); canvas.setOverlayImage(bgImgS ...

Is it better to use relative or absolute resource scripts in an AngularJS application?

My project involves building a single-page JavaScript app using AngularJS. In order to achieve this, the index.html file has a specific structure: <html> <head> <base href="/" /> ... </head> <body id="ng-app" ng-app="myAngularAp ...

Concealing the view-source feature in core PHP or HTML

Is there a way to conceal view-source in basic php or html? I've come across some information on this topic, but I'm having trouble grasping how to implement it: Web Developer Class: How to Hide your Source Code ...

How to maintain the selected value in a Vue.js dropdown even after the page is refreshed

When a user selects a value from a dropdown, it is pushed to the URL. If the page is refreshed, the dropdown should default to the selected value in the URL. This functionality is being implemented in Laravel. I have attempted the following approach, but w ...

Utilizing dynamically assigned ng directives in my unique custom directive

I'm in the process of creating a customized table element that looks like this: <datatable items='tableItems' columns='columnsConfig' /> Here, 'tableItems' represents my array of items and 'columnsConfig&apos ...

Set up linter rules that utilize `useEffect` in place of `React.useEffect` (utilizing named export rather than full export)

It's important in our codebase to always use: import { useEffect } from 'react'; instead of: import React from 'react'; // use in code as `React.useEffect` Can we enforce this rule with longer eslint rules? If so, how can we impl ...

What could be causing the bullet not to appear in Internet Explorer 6

It is visible in Firefox, but not in IE (specifically IE6). <style type="text/css"> li { list-style-type:disc; } </style> <div style="margin: 2px auto 15px; padding: 5px 0px; width: 480px; text-align: center;"> <ul style="margin: 0; ...

Steps for constructing an object containing an array of nested objects

I've been working on this problem for some time now, and it's starting to feel like a messy situation that just won't come together. I'm trying to recreate an object with 5 properties and a nested array of objects, but so far, it's ...

When package.json is imported, files are not compressed

Currently, I am working on developing a cli package and when it comes to displaying the version, I am utilizing the version imported from package.json. Upon running tsc, the structure of the dist folder appears as follows: /dist --/package.json --/README. ...