473,657 Members | 2,450 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with dynamicaly adding a hidden form element. IE vs NN

I am trying to get a form to dynamicaly add hidden elements. Below is the
function I've created, basicaly it loops thru an array and attempts to add
those values to a newly created hidden input field which it then appends to
the form. I works in IE, but in NN7 nothing is passed.

function processAssortme nt(){
// get the form Element
var formElement=doc ument.getElemen tById("candyBox Form");

//loop thru the candy box contents, add them to the form
for(var x=0;x<CandyBox. size;x++){
var stringNewEle = '<input type="hidden" name="'+'name_' +x+'"
value="'+CandyB ox.BoxContents[x].id+'" id='+x+'>'
newField=docume nt.createElemen t(stringNewEle) ;
formElement.app endChild(newFie ld);
}

document.assort mentForm.submit ();

}

Thank you
Paul
Jul 20 '05 #1
2 11815
"Paul" <pa********@hot maill.com> writes:
I am trying to get a form to dynamicaly add hidden elements. Below is the
function I've created, basicaly it loops thru an array and attempts to add
those values to a newly created hidden input field which it then appends to
the form. I works in IE, but in NN7 nothing is passed.
The argument to createElement is the tag name, not the entire tag. That is
a proprietary Microsoft extension.
var stringNewEle = '<input type="hidden" name="'+'name_' +x+'"
value="'+CandyB ox.BoxContents[x].id+'" id='+x+'>'
newField=docume nt.createElemen t(stringNewEle) ;


Change this to
newField = document.create Element("input" );
newField.type = "hidden";
newField.name = "name_"+x;
newField.value = CandyBox.BoxCon tents[x].id;
newField.id = x;

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Thank you :)

"Lasse Reichstein Nielsen" <lr*@hotpop.com > wrote in message
news:65******** **@hotpop.com.. .
"Paul" <pa********@hot maill.com> writes:
I am trying to get a form to dynamicaly add hidden elements. Below is the function I've created, basicaly it loops thru an array and attempts to add those values to a newly created hidden input field which it then appends to the form. I works in IE, but in NN7 nothing is passed.
The argument to createElement is the tag name, not the entire tag. That is
a proprietary Microsoft extension.
var stringNewEle = '<input type="hidden" name="'+'name_' +x+'"
value="'+CandyB ox.BoxContents[x].id+'" id='+x+'>'
newField=docume nt.createElemen t(stringNewEle) ;


Change this to
newField = document.create Element("input" );
newField.type = "hidden";
newField.name = "name_"+x;
newField.value = CandyBox.BoxCon tents[x].id;
newField.id = x;

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors:

<URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html> 'Faith without judgement merely degrades the spirit divine.'

Jul 20 '05 #3

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

Similar topics

3
5756
by: Lee Mundie | last post by:
Hi there, Simple problem here but can't seem to fix it! Okay, I have a select list from which people choose avatars... the list is option values ie. <option>Worm</option> <option>Frog</option> etc etc and is in an include file... where the word i.e. worm sources the image ..images/worm.gif - simple so far...
6
2824
by: Amir Hardon | last post by:
I'm new to DOM and can't figure out this thing: I'm trying to add a row to a table with a form field in one of it's cells, but if I'm appending the field to a form it gets out of the table. Can some one tell me what I'm doing wrong? it looks like this: var tbl=document.tbl; var frm=document.frm; var newcell=document.createElement("TD");
2
338
by: Martin Nadoll | last post by:
Hello, i try to submit a form with textlink like this snippet: <a href="javascript:document.bestellen.submit()">bestellen</a> <form name="bestellen" method="post" action="myPage.cfm?ID=4300&do=action"> <input name="category" type="hidden" value="2"> <input name="Product" type="hidden" value="423"> <input name="Price" type="hidden" value="15">
7
1475
by: exxos | last post by:
HI all, This has had me confuzzeled for a while now, I've read countless threads on such errors and it seems to be down to the way things are set out and loaded. Can anyone suggest why this code throws up the null or not object error ? The crazy thing is it all actually works fine aswell..... <script language='JavaScript'>
6
2999
by: Omar | last post by:
Hi, In a JSP I have the next: .... codigo = "<select name='" + nombre + "'>\n<option selected value='default'>Escoge</option><option value='todos'>Todos</option>"; if (miRS != null) while (miRS.next()) {
3
1668
by: wolis | last post by:
Hi all, In an AJAX environment, is it possible to load and display some HTML and JavaScript and have that JavaScript functional? I have tried but the JavaScript functions dont appear to be visible - Im assuming this is becasue they were not loaded when the initial AJAX application/page originally loaded. Conceptual example if it helps:
1
2463
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this guy's Javascript "combo box" - http://sandy.mcarthur.org/javascript/select/select.html. It allows my users (when I get some!) to select from a list of preexisting options and also to add a new one by clicking on "add new". Essentially it's a select...
1
1641
by: YotamElal | last post by:
Hello, I have a popup problem. When a popup is opened, I want all other popups to close immediatly. (except for its self and it's child popups) Here is my code: code: <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'> <html>
13
2646
by: windsorben | last post by:
I have some javascript that checks whether or not an answer is correct. It was working fine when the question was asked with text but now that I'm asking the question with audio, the javascript no longer works. (I think it is considering the embed tag as an element in my form and I think that's causing the problem.) I think adding and specifying to only look at a div tag within the form would solve the problem but I'm not sure. Can someone...
0
8421
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
8844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8621
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
5643
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
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.