473,406 Members | 2,356 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,406 software developers and data experts.

passing variables assigned from input box

127 100+
Hi all,

I'm try to set up a hidden variable that takes the value of an input:

Expand|Select|Wrap|Line Numbers
  1. bFINALTEXT1 = document.createTextNode("Final:");
  2. bFINAL1 = document.createElement("input");
  3. bFINAL1.style.width="5em";
  4. bFINAL1.type="text"
  5. bFINAL1.name=compXY+'comp[]';
  6. //bFINAL1.onblur=function(){getfinal(this.value);};
  7.  
  8. bMAX1 = document.createElement("input");
  9. bMAX1.type="hidden"
  10. bMAX1.name=compXY+'comp[]';
  11. //
  12. bMAX1.value=bFINAL1.value
  13.  
As you can see, I had originally been using a function (getfinal) which works fine if I don't dynamically add duplicate inputs that get different values. To solve this problem. I was hoping that I could just copy the X.value across, but it doesn't work.

Any ideas?

Thanks in advance
Jul 31 '09 #1
1 1773
hsriat
1,654 Expert 1GB
At the time you are assigning the value to the hidden input, the text input has no value. And the expression bMAX1.value=bFINAL1.value doesn't provide a synchronise mechanism for run time.

So you would have to do it when some event is fired. onchange can be a good choice.

Expand|Select|Wrap|Line Numbers
  1. a.onchange = function() {b.value = this.value;}
I don't understand the purpose behind it, as at the end, you have two variables of same value, that can also be done at server end(?).
Jul 31 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Fredrik/Sweden | last post by:
Hi folks ! got this problem... i have a table 'Accounts' in my database, which contains a bunch of users. From the main menu i choose "edit user" and all users in the db are presented in a table....
2
by: kie | last post by:
hello, when i create elements and want to assign events to them, i have realised that if the function assigned to that element has no parameters, then the parent node values can be attained. ...
2
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
25
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default...
9
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script...
1
by: phoenix917 | last post by:
I have been working on this code for 5 days... I have read multiple tutorials and looked at various code. This is my third forum try... :) My instructor refuses to help me. I think it's because...
4
by: ATDave | last post by:
So basically I'm just creating a form that I want the results e-mailed to somebody. I have everything working except for the checkmark sections that can have multiple answers. I'm a newbie when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.