473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

how do i pass control(text field) values from one html to other using hidden variables.


function submitPartsForm(str) {

var count=document.getElementsByName("partId");
for(var i=0;i<count.length;i++)
{

document.mylist.myNum[i].value= document.getElementsByName("partNum")
(i).value;

}

document.forms["mylist"].submit();
}
myNum[] is a hidden variable and partNum is the name of a text field
that has many instances i mean there are many textfields with the same
name so it forms a column in a data table.

Mar 7 '07 #1
3 3149
pr***********@gmail.com wrote:
>
function submitPartsForm(str) {

var count=document.getElementsByName("partId");
for(var i=0;i<count.length;i++)
{

document.mylist.myNum[i].value= document.getElementsByName("partNum")
(i).value;

}

document.forms["mylist"].submit();
}
myNum[] is a hidden variable and partNum is the name of a text field
that has many instances i mean there are many textfields with the same
name so it forms a column in a data table.
Why not give each each textfield a unique name?
I cannot think of one good reason...

Regards,
Erwin Moller

Mar 7 '07 #2
On Mar 7, 12:14 pm, Erwin Moller
<since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
prabodhtiw...@gmail.com wrote:
function submitPartsForm(str) {
var count=document.getElementsByName("partId");
for(var i=0;i<count.length;i++)
{
document.mylist.myNum[i].value= document.getElementsByName("partNum")
(i).value;
}
document.forms["mylist"].submit();
}
myNum[] is a hidden variable and partNum is the name of a text field
that has many instances i mean there are many textfields with the same
name so it forms a column in a data table.

Why not give each each textfield a unique name?
I cannot think of one good reason...

Regards,
Erwin Moller
Try naming them as follows:
<input name="partnum[]" ...>
In PHP, these are automatically converted into an array inside your
protocol-dependent superglobal (_GET or _POST), so you can use them at
will, although, if this is a static html, why not really give them all
unique names, as Erwin suggested.

Mar 7 '07 #3
On Wed, 07 Mar 2007 11:00:16 +0100, <pr***********@gmail.comwrote:
>
function submitPartsForm(str) {

var count=document.getElementsByName("partId");
for(var i=0;i<count.length;i++)
{

document.mylist.myNum[i].value= document.getElementsByName("partNum")
(i).value;

}

document.forms["mylist"].submit();
}
myNum[] is a hidden variable and partNum is the name of a text field
that has many instances i mean there are many textfields with the same
name so it forms a column in a data table.
One way would be to join the text values together using a join character
unlikely to appear in the texts, like so:

function submitPartsForm() {
var theNodeList = document.getElementsByName("partId");
var theNodeValues = document.forms["myList"].elements["theNodeValues"];
if(theNodeList&&theNodeValues) {
for (var i=0;i<theNodeList.length;i++) {
if (theNodeList[i].value) {
theNodeValues.value += ("|" + theNodeList[i].value.toString());
}
}
document.forms["myList"].submit();
}
}

(Above script assumes the form has a hidden input (not disabled), named
"theNodeValues".)

Then in your server-side script you can use whatever method your language
uses to split the string into parts using the "|" as a split character.
Usually this results in an array.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Mar 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ben | last post by:
Hi, When clicking on a button, a new record must be created in an Access table. See my code: <% set objdc = Server.CreateObject("ADODB.Connection")...
3
by: Treetop | last post by:
I would like to pass text to a popup window to save creating a new html file for each help topic. I would like to have a value for the heading, a value for the text, code for printing the help...
1
by: Chris John Jordan | last post by:
Can anyone suggest a way of getting FORM to post only its own control values? I find by default each FORM on a page POSTs the variables of all FORMs on the page, and this prevents my common ACTION...
2
by: blurz | last post by:
Hi, would like to know whether I can use ViewState to pass variables from one web page to another. I've been trying do this but all I managed to do is to pass the variable to the target page but...
6
by: kath | last post by:
hi everyone......... I have a task, I have fragmented the task into subtask. I have planned to create a class to each subclass and one parent class to handle the sub tasks. Each subclass are...
2
by: Sheena777 | last post by:
how do you pass parameters to a script file? I want to pass values from a vb.net textbox to vb script file. The whole point of this is to be able to run the validation of the control from the script...
4
by: luftikus143 | last post by:
Hi there, I would like to pass HTML code from one page to another. As with parameters, I would like to use "input type=hidden".... But somehow the HTML must be encoded, otherwise my whole page...
2
by: jayachandrav | last post by:
Hello, How to pass values from the html page to the codebehind of the same page. Thanks for advance, JC.
6
by: =?Utf-8?B?Unlhbg==?= | last post by:
I am trying to pass a value from a texbox in Form1 to a textbox in Form2 using properties in VS2005 but it doesn't work; please help (project is attached). Code for Game Class: using System;...
0
Markus
by: Markus | last post by:
What's the best way to pass variables to a flash document? I've googled it and gotten answers, but most of them seem to be using old flash versions and invalid syntax (html). Ergo, I'm hesitant to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.