Dev't Tool: Visual C# 2003 and Javascript
System Type: Web Application

One requirement of the system is to dynamically create a table on client-side (Javascripting using createElement method.) The table has textboxes inside each cell.

a few sample code:

for (i = 0; i < 4; i ++) // four columns
{
textBoxes = document.createElement("INPUT");
textBoxes.type = "text";
textBoxes.id = "txt1";
textBoxes.name = "txtA";
cell.appendChild(textBoxes);
}

These are my options to get the values:
1. Through querystring -> but not possible because there are many values to be passed.
(sample: WebForm2.aspx?value1=&value2)

2. Also tried getting it by Request.Form["txtA"]
I can get the values but it is comma delimited. I cannot get exact data when my input has "," in it.
(sample: Input1 = "a,b"; Input2= "c"; Request.Form["a,b,c"])
if to be split, 3 values will be returned instead of 2.

Maybe there's another option that you can suggest so I can retrieve those multiple data.

One more thing, I would like those data to be on one-time retrieval because in the INSERT process, I plan to include them on a loop inside a TRANSACTION statement so if one record encountered an error, all will ROLLBACK.

As per the specification, in a HTML document, the ID attribute must be unique. Assign a different ID and NAME to each INPUT element. Don't use GET, use POST for sending your form data.

Thanks for the reply. I solved the problem by using my 2nd option which I stated before (Request.Form["txtA"]).

I just created a function that replaces "," with "%2c" so that if a user tends to input a value with ",", the parser will not treat it as a delimiter, thus splitting the returned value accurately.

There is a better way of doing the same thing which encodes the URI component to avoid all such problems:

encodeURIComponent("a,b,c"); // a%2Cb%2Cc
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.