473,942 Members | 15,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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


function submitPartsForm (str) {

var count=document. getElementsByNa me("partId");
for(var i=0;i<count.len gth;i++)
{

document.mylist .myNum[i].value= document.getEle mentsByName("pa rtNum")
(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 3173
pr***********@g mail.com wrote:
>
function submitPartsForm (str) {

var count=document. getElementsByNa me("partId");
for(var i=0;i<count.len gth;i++)
{

document.mylist .myNum[i].value= document.getEle mentsByName("pa rtNum")
(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_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
prabodhtiw...@g mail.com wrote:
function submitPartsForm (str) {
var count=document. getElementsByNa me("partId");
for(var i=0;i<count.len gth;i++)
{
document.mylist .myNum[i].value= document.getEle mentsByName("pa rtNum")
(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. getElementsByNa me("partId");
for(var i=0;i<count.len gth;i++)
{

document.mylist .myNum[i].value= document.getEle mentsByName("pa rtNum")
(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.getEle mentsByName("pa rtId");
var theNodeValues = document.forms["myList"].elements["theNodeVal ues"];
if(theNodeList& &theNodeValu es) {
for (var i=0;i<theNodeLi st.length;i++) {
if (theNodeList[i].value) {
theNodeValues.v alue += ("|" + 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
1982
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") objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source =c:\access\mydb.mdb") %>
3
2920
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 page, and code to close the window. ------------------------------------------ the help window code is following <SCRIPT LANGUAGE="JavaScript"> <!-- Begin
1
1924
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 script from processing each FORM individually. Thanks. -- Chris
2
2354
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 am unable to extract the variable out to print on the page. The source of the target page reflects a ViewState value being passed. My code is as below: (On 1st page) ViewState("name") = Name Response.Redirect("targetpage.aspx")
6
4743
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 saved in seperate file and all my subclasses and parent class are placed in the same folder. The parent class is subclass of wx.Frame, and subclasses are subclass of wx.Panel. Each subclass will create a GUI for each task..
2
1062
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 file.
4
1625
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 sucks. Is there an easy way to do that? Thanks for any suggestions!
2
1917
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
1712
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; using System.Collections.Generic; using System.Text;
0
1834
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 trust it. Also, how do you obtain the values inside of the flash document?
0
10135
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9969
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6305
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.