Generated Form Data Automatically

Seeking advice on achieving a specific functionality in ASP.NET Web Form that is similar to the AutocompleteExtender, but requires more flexibility. Here is what I aim to accomplish:

  • There are 2 TextBox fields on the form: CompanyName and CompanyRef (a unique abbreviated identifier for companies).
  • User enters the CompanyName.
  • Once there are 3 characters in the CompanyName field, an internal webservice is triggered (possibly AJAX).
  • The webservice evaluates the entered text and generates a 3-character representation - for example, "Stack" might result in STA0001.
  • If STA0001 already exists in the database, the webservice would return STA0002 or the next available variation.
  • The generated value will be populated into the CompanyRef TextBox.
  • Users should have the ability to edit the CompanyRef if needed.

I am not looking for specific code examples, but rather guidance on how to approach this task at a higher level. If there are any missing components or resources you can suggest, it would be greatly appreciated as my searches online haven't yielded helpful results so far. Maybe I'm not using the right search terms.

Answer №1

Creating the CompanyRef can be a straightforward process. Numerous resources are available that provide information on combining an autonumber or counter with a string. However, I have reservations about your approach of allowing users to manipulate the reference and create their own. What is the purpose behind this?

[UPDATE - Response to comment]

The character limit in the comment box prevented me from fully addressing your query (and I am still adjusting to the guidelines here...)

You could utilize AJAX to access the web service and retrieve the current available values, then use javascript to update the field accordingly. Yet, there is a potential issue where a user may select a value that becomes unavailable by the time it reaches the database. Consequently, you may need to conduct a final check, resulting in a message to inform the user that they cannot use the value they initially chose. The likelihood of this occurrence depends on the number of simultaneous users on your platform.

I have written an article on utilizing jQuery to call web services, which might serve as a helpful starting point for implementing the AJAX feature:

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

Populate a table dynamically using JavaScript based on existing cell values

I am currently working on filling an HTML table based on the contents of its left cells. The code below creates a table that is populated with variables: <table id="myTable" ></table> <script> var rightcell = [{name : "Name ...

Creating a customized component using unique styles in Material UI version 1

Currently, I am facing a challenge in styling my Card component with a width of 75 pixels while using Redux and Material UI V1. Despite following the example provided by Material UI on custom styling through withStyles and connect, I have not been able to ...

Leveraging recompose utility within the structure

I am exploring the use of recompose utility functions as a React element, enabling me to incorporate them into JSX as higher-order components (HOC). const enhancedInput = props => { return (<OnlyUpdateForKeys keys={['name']> ...

Show the range upon user interaction with the textbox and perform validation in ASP.NET

Is there a more efficient method to display a popup with a textbox range when the user tabs into or clicks on the textbox, and validate it if they enter a non-range value in asp.net? I am currently using js and css to show a panel using z-index without any ...

What is the best way to divide my value sets using jQuery?

Within a given string such as 28_34/42/34,23_21/67/12,63_5/6/56, I am seeking to split or eliminate sets based on the ID provided. For example, if the ID is 23, then the set 23_21/67/12 should be removed. To achieve this, I am checking the value after the ...

What is causing this substring to not function properly in Chinese text?

What could be causing this issue with the substring function when dealing with Chinese text? I have successfully used it for other languages, but when working with Chinese characters, I am getting an empty string as a result. countryID = "奥地利 ...

Converting a file into a blob or JavaScript file in NodeJS: A step-by-step guide

I have a function that is designed to accept a file in this particular format using the multer package. Now, my goal is to upload this file to Firebase storage, but before I can do that, it needs to be converted into either a Blob or a Javascript file. Th ...

Plugin refresh after callback

I have a webpage that features a row of buttons at the top, followed by some content below. Whenever one of the buttons is clicked, the content is updated using UpdatePanels. Within this content, I am attempting to incorporate the royal slider plugin, wh ...

The XMLHttpRequest onload() function is failing to pass an instance of the XMLHttpRequest object

I am facing an issue with a function that sends a basic AJAX request to my server. The JavaScript code in the browser is as follows: function testRequest() { var xhr = new XMLHttpRequest(); xhr.onload = () => { console.log("RESPONSE R ...

Creating a script in JavaScript to execute a command or query after midnight

I have a query regarding MongoDB and JavaScript (Express.js). Here is the scenario: I am working on developing a backend service for movies and TV series. I have already set up basic routes and functions. One of my requirements is to select a movie from ...

After switching from jQuery to pure JavaScript, the code is now up and

After initially coding in jQuery + AJAX, I attempted to rewrite it in vanilla JavaScript. However, the code is not functioning as expected now. Can someone help me identify the mistake causing nothing to display when I run it through the server? I have che ...

Arranging a dropdown list of options in alphabetical order using Javascript

Could you assist me in sorting my select list alphabetically? Below is the code I currently have:- $.getJSON("php/countryBorders.geo.json", (data) => { $select.html(""); for (let i = 0; i < data["features"].leng ...

Trigger the submission of Rails form upon a change in the selected value within a dropdown form

I am working on a Rails application that has a table of leads. Within one of the columns, I display the lead's status in a drop-down menu. My goal is to allow users to change the lead's status by simply selecting a different value from the drop-d ...

Start up a server-side JavaScript instance utilizing Express

My journey into web programming has led me to learning JavaScript, Node.js, and Express.js. My ultimate goal is to execute a server-side JavaScript function (specifically a function that searches for something in a MySQL database) when a button is pressed ...

Updating the count property of an object using setState in React

I have an array of integers ranging from 0 to 6 as my input. My goal is to create an object that gives the count of each number in the array. edition = [6, 6, 6, 1, 1, 2]; const [groupedEdition, setGroupedEdition] = useState([{"0": 0, "1&quo ...

Unable to access the done property in an AJAX JSON promise

Trying to dive into the world of JavaScript promises. My goal is to create a button that triggers a function displaying the result of a promise from another function. So far, I've been following tutorials and here's where I'm at: function my ...

Most effective method for integrating a JS module across all browsers

I have created a robust library that I want to integrate into a different web project. This library handles all its dependencies and consists of js, css, and html files. My ideal scenario would be to package it as an npm module and simply use import to in ...

Tips for altering the color of a specific bar in the Material UI BarChart component

I have implemented the following code to generate a Graph: const namesArray = Object.values(tableData).map(item => item.name); const valuesArray = Object.values(tableData).map(item => item.value); return ( <Box> <SimpleCard ti ...

Tips for modifying a list item on a different page

The Scenario When using Sharepoint 2010, I am able to select an item from a list: This action then displays the Read/Edit view on that page: My Objective I have a WebPart located on a different Page where I display items from various lists, including t ...

What is the method for assigning classes to a Vue.js Functional Component from its parent component?

Imagine a scenario where I have a functional component: <template functional> <div>Some functional component</div> </template> Now, when I render this component within a parent element with classes: <parent> <som ...