Using perl ajax to modify a table

In my current Perl script, I am working on a functionality where I retrieve data from an xls file and display it as input text on a webpage. The objective is that when a user selects the edit option from a menu, the entire table fetched from the xls file will be displayed and the existing values will be shown in text boxes.

However, my challenge arises when the user edits the cells and clicks on save. Although I am able to send all the IDs to a Perl function, I struggle with mapping the edited cells back to their corresponding positions in the table.

For example, if a user enters a new value "A" for column 1, row 1 and another value "B" for column 2, row 1, how can I inform my Perl function that "A" should go to Column 1, Row 1 and "B" should go to Column 2, Row 1? Is there a way to achieve this mapping, similar to sending a 2D array to a Perl subroutine from a submit button using Ajax?

Answer №1

When naming the control, make sure to incorporate both the row and column into it. This will allow you to utilize the provided code snippet or its equivalent in JavaScript:

let [$row, $col] = $param_name.match(/^cell([0-9]+)_([0-9]+)\z/)
   || throw new Error();

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

The value of "asp-route-id" is dynamically determined through the use of

Hey there, I’m looking to dynamically pass a value from "codeDrink" to my controller using "asp-route-id" and Ajax in my ASP.NET MVC project. This is how I am handling it in my view: <p> <a id="deleteLink" asp-action="Delete& ...

Image Animation Using a Rotational Control (HTML/JavaScript/...)

I am interested in achieving a specific effect with a series of images that transition from dark to light. My idea is to have a dial or slider underneath or over the frame so that when it is moved to the left, the black image is displayed, and when moved t ...

Having trouble storing data in a MYSQL database with NodeJS and ReactJS

When trying to submit the form, a "Query Error" popup appears and data is not being saved in the database. API router.post("/add_customer", (req, res) => { const sql = `INSERT INTO customer (name, mobile, email, address, state, city, policytype, insu ...

Chrome debugging tool does not refresh page source

This issue has been lingering for quite some time and despite similar questions, I have not come across a satisfactory solution. The problem lies in the fact that the SOURCE used to step through the code does not refresh with every page load. Disabling the ...

Trigger the AJAX method once the partial post back has finished executing

Currently, I am facing an issue with my update panel on the webpage. Within $(document).ready(), I trigger a partial post back of the update panel. After this partial post back is done, I need to make an AJAX call like the one below: __doPostBack('&l ...

Having trouble with the find method when trying to use it with the transform

In my code, I have three div elements with different values of the transform property assigned to them. I store these elements in a variable using the getElementsByClassName method and then try to find the element where the value of the transform property ...

Is the implementation of Ajax correctly functioning in Firefox? Is there a synchronous issue occurring?

Upon examining the code below, consider which log will be displayed first: In Chrome & IE, "sync ajax call: success" is printed first as expected, However, in FF (tested in FF 3.6 & FF 17.0), "async ajax call: success" appears first instead, indica ...

Exploring the capabilities of NodeJS together with the fetch function of Backbone

I have a code snippet for the front-end using fetch: var MyModel = Backbone.Model.extend(); var MyCollection = Backbone.Collection.extend({ url: '/questions', model: MyModel }); var coll = new MyCollection(); ...

Error message: Unexpected token discovered, Functioned correctly on Windows yet encountering issues on the VPS. Any suggestions for resolving this?

Challenge: After transitioning my code from a Windows machine to a VPS, everything was working fine on my PC. However, upon migrating to the VPS, I encountered the error listed below: /root/node_modules/discord.js/src/client/Client.js:41 } catch { ...

Stop unauthorized entry into JavaScript files

Is there a method to secure JavaScript files from unauthorized access? <script src="JS/MyScript.js" type="text/javascript"> It is crucial that users are unable to access the MyScript.js file. I am seeking advice on how to achieve this. Is it even ...

Collaborative Desktop & Web Application powered by Javascript REST/Ajax

Currently, my node.js back-end is seamlessly working with a web-based JavaScript client by sending AJAX requests. However, I am now contemplating creating a compact desktop version of the JavaScript client using solely JavaScript, specifically leveraging ...

Is there a way to update the input box value with a variable using jquery?

I am currently facing an issue with changing the value attribute of an input box in a form using jquery. Although I am able to change the value, it does not reflect in the outer html. Below is my current code snippet: $("a").click(function(event) { va ...

I'm attempting to install the "firebase" package using npm, but I keep encountering a python-related error message during the installation process

I am experiencing difficulties while attempting to install the firebase package in a local expo-managed project. Unfortunately, I keep receiving the following error message... Here is the error message that I am encountering I have already tried using "e ...

Laravel encountered an error: MethodNotAllowedHttpException occurred without a message

When attempting to submit a form using Ajax, I encounter the following error: MethodNotAllowedHttpException No message. It seems like the issue lies in the routing, as it works fine when tested without Ajax. Below is my Ajax code: $.ajax({ met ...

When THREE.js repeatedly loads and plays the same animated GLB file in a loop, only the final model that is loaded will

I'm attempting to create a loop of animated butterflies, but I'm encountering an issue where only the first or last butterfly actually animates. I suspect this is due to the need to clone the gltf.scene, but there's a known bug with cloning ...

The Cordova application developed in XDK for Android is preventing Ajax requests over HTTPS

Initially, everything functions smoothly with regular Ajax requests over http. However, the issue arises when attempting to execute the same Ajax request (GET) over https. While using WEINRE for debugging, I noticed that the requests are stuck in a pendin ...

Tips for extracting a value from an input array using the enter key with ajax

After experimenting with ajax, I encountered an issue where pressing the enter button would only return the first array result. However, my desired outcome is to capture the input value of the current field. Below is the html code snippet: <tbody clas ...

Enhancing jQuery Rating Plugin

Currently, I am working on customizing the jQuery Bar Rating System Plugin. You can view an example of the plugin by visiting this link: . The rating system on my end will resemble Example D. Rather than having the plugin based on user input, my goal is to ...

What causes the event parameter to be lost during recursion?

Below is the given code snippet: <html> <head> <meta charset="UTF-8"> <title>title...</title> <link type="text/css" rel="stylesheet" href="jquery-ui-1.10.4.custom.css" /> <script type="text/javascript" src="jq ...

Switching a boolean value in Rails 4 using link_to

Looking to implement a link that can toggle a boolean value using ajax. I initially tried following this tutorial, but it wasn't compatible with rails 4. If anyone has advice on the best way to make this functionality work, I'd appreciate it. ...