473,756 Members | 2,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checkboxes created using Javascript DOM not available in $_POST

69 New Member
Hi,

I have a Javascript function that creates a number of checkboxes dynamically using document.create Element. The checkboxes are created fine but even when they are checked they don't appear in $_POST in Internet Explorer. The same code works fine in Firefox and I can get the details of the checkboxes that are checked. Does anyone know of any problems with checkboxes in IE?

Thanks,

Sean
Oct 13 '07 #1
2 1818
pbmods
5,821 Recognized Expert Expert
Heya, Sean.

Make sure you're attaching the checkboxes to an element inside the form.

For example:
Expand|Select|Wrap|Line Numbers
  1. function addCheck()
  2. {
  3.     var newCheck = document.createElement('input');
  4.     .
  5.     .
  6.     .
  7.     document.getElementById('insertHere').appendChild(newCheck);
  8. }
  9.  
If insertHere is here:
Expand|Select|Wrap|Line Numbers
  1. <form ... >
  2.     .
  3.     .
  4.     .
  5. </form>
  6.  
  7. <div id="insertHere"></div>
  8.  
then the new checkboxes will not be submitted with the form. But if insertHere is here:
Expand|Select|Wrap|Line Numbers
  1. <form ... >
  2.     .
  3.     .
  4.     .
  5.     <div id="insertHere"></div>
  6. </form>
  7.  
The new checkboxes will be submitted.
Oct 13 '07 #2
Sebarry
69 New Member
Yep thought of that but it's definately not that. I don't understand why it works in Firefox but not IE.

Expand|Select|Wrap|Line Numbers
  1. var cb = document.createElement( "input" );
  2. cb.type = "checkbox";
  3. cb.name = htmlIdName;
  4. cb.id = htmlIdName;
  5. cb.value = xmlOptions[i].getElementsByTagName('id')[0].firstChild.data;
  6. subDiv.appendChild( checkBoxName );
  7. subDiv.appendChild( cb );
  8. subDiv.innerHTML += "<br />";
  9.  
Like I said when I put in an alert I can print out the value and checked status of my checkboxes but even when they're checked they don't appear in $_POST.

It's strange and frustrating.

Heya, Sean.

Make sure you're attaching the checkboxes to an element inside the form.

For example:
Expand|Select|Wrap|Line Numbers
  1. function addCheck()
  2. {
  3.     var newCheck = document.createElement('input');
  4.     .
  5.     .
  6.     .
  7.     document.getElementById('insertHere').appendChild(newCheck);
  8. }
  9.  
If insertHere is here:
Expand|Select|Wrap|Line Numbers
  1. <form ... >
  2.     .
  3.     .
  4.     .
  5. </form>
  6.  
  7. <div id="insertHere"></div>
  8.  
then the new checkboxes will not be submitted with the form. But if insertHere is here:
Expand|Select|Wrap|Line Numbers
  1. <form ... >
  2.     .
  3.     .
  4.     .
  5.     <div id="insertHere"></div>
  6. </form>
  7.  
The new checkboxes will be submitted.
Oct 14 '07 #3

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

Similar topics

2
3965
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the checkboxes are picked up using $_POST and put into session variables. On page two there is another form which is simply a condensed version of the previous one (titles with no descriptions). The checkboxes are named the same on both forms. When...
4
791
by: Ken | last post by:
I have a two checkboxes in HTML: <input TYPE="checkbox" NAME="cc" VALUE="true"></td><td><b>Credit Card</b></td></tr> <input TYPE="checkbox" NAME="cash" VALUE="true"></td><td><b>Company Check</b> <input type=button onClick='<?php reviewpayment()?>' value='Continue' style='font: 10pt Arial;
9
2768
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your response. Sergio ------------------------------------------------ <script language="JavaScript" type="text/javascript">
15
8839
by: Sonnich | last post by:
Hi all! I have a file where I'd have to submit buttons, and I need to differ between those. Step #1 - open html win with default selection Step #2 - user may select some criteries for the list Step 2 might be repeated, or not used at all. There is a button "apply selection"
2
1745
by: GustavoBrust | last post by:
Hello everyone. I'm having a problem with a search I want to make. It's like this: The user can choose about 15 checkboxes to be his search pattern. According to the combination of checkboxes checked, I must do a different query.
4
3313
by: jeet | last post by:
Plz help me.Problem is that On the first page I display all other user with checkbox and give user option to select only two user which he wants to send message. Tell me please how I'll get those checkboxes value and name on the next page and send message to only those two selected user. Thanx in advance
9
48452
by: Sebarry | last post by:
Hi, I've put together a little test page to create checkboxes each time a button is clicked. The check button is created and should be appended to the form, but when the post is submitted the dynamic checkboxes are not available in $_POST in PHP. Here's the code: <html> <head> <script language="Javascript">
2
5924
by: phpachu | last post by:
Hi, I hav created a group of textboxes using a loop and its names are unique and names are assigned using variable ( like <input type=text name=$name1>). Then How can i retrieve the values in that textboxes after a button click with in a loop. Really I cant move from here. Can anyone plz help me.. Part of the my code is given below <html> <table> <?php // i hav an array "assocArray" and its count is "countarray" for($i = 1; $i <...
6
2365
by: ahilar12 | last post by:
<html> <head> <script type="text/javascript"> function SetAllCheckBoxes(FormName, FieldName, CheckValue) { if(!document.forms) return; var objCheckBoxes = document.forms.elements; if(!objCheckBoxes) return;
0
9456
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
9275
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
9873
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...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
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
6534
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
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
3
2666
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.