473,395 Members | 1,823 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,395 software developers and data experts.

form post not detecting input fields added via AJAX

omerbutt
638 512MB
HI I am WORKING ON A PROJECT IN WHICH I HAVE TO CREATE SOME INPUT FIELDS by selecting the number of inputs from a select menu the problem is that when i post the form the fields inside the div are not posted along with the form where as the div in which i am populating the inputs resides within the form
here is the code
Expand|Select|Wrap|Line Numbers
  1. var xmlCartInputs;
  2. function getCartInputs(val){
  3.     if(val!="none"){
  4.         xmlCartInputs=GetXmlHttpObject();
  5.         if(xmlCartInputs==null){
  6.             alert("Please Upgrade Your Browser");
  7.             return;
  8.         }else{
  9.             var url="installation/inputs.php";
  10.             var str_tf="t_inputs="+val;
  11.             xmlCartInputs.onreadystatechange=$loadPages;
  12.             xmlCartInputs.open("POST",url,true);
  13.             xmlCartInputs.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
  14.             xmlCartInputs.send(str_tf);
  15.         }
  16.     }
  17. }
  18. function $loadPages(){
  19.     if(xmlCartInputs.readyState==4){
  20.         if(xmlCartInputs.status==200){
  21.             document.getElementById("cart_inputs").innerHTML=xmlCartInputs.responseText;
  22.         }
  23.     }
  24. }
  25.  
Expand|Select|Wrap|Line Numbers
  1. <form name="step2" id="step2" target="_self" method="post" onsubmit="return formchk(this);" action="">
  2.                 <tr>
  3.                     <td></td>
  4.                     <!--<td align="right" valign="middle" width="50"><input type="button" name="prev" id="prev" value="Previous" /></td>-->
  5.                     <td valign="middle" width="50"><input type="submit" name="next_2" id="next_2" value="Next" /></td>
  6.                 </tr>
  7.                 <tr>
  8.                     <td align="center" valign="middle" colspan="3">
  9.                         <table cellspacing="0" cellpadding="5" align="center" width="300" border="0">
  10.                             <tr>
  11.                                 <td valign="middle">Total Cart Columns</td>
  12.                                 <td valign="middle">
  13.                                 <select name="cart_columns" id="cart_columns" onchange="getCartInputs(this.value);">
  14.                                     <option value="none">Select Columns</option>
  15.                                     <?php
  16.                                         for($r=1; $r<=20; $r++){
  17.                                             echo "<option value=\"$r\">$r</option>";
  18.                                         }
  19.                                     ?>
  20.                                 </select>
  21.                                 </td>
  22.                             </tr>
  23.                             <tr>
  24.                                 <td align="center" valign="middle" colspan="2">
  25.                                     <div id="cart_inputs"></div>
  26.                                 </td>
  27.                             </tr>
  28.                         </table>
  29.                     </td>
  30.                 </tr>
  31.             </form>
  32.  
FILE INPUTS.PHP CODE
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
  3.     header('Cache-Control: no-store, no-cache, must-revalidate');
  4.     header('Cache-Control: post-check=0, pre-check=0', FALSE);
  5.     header('Pragma: no-cache'); 
  6.     include("config.php");
  7.     if(isset($_POST['t_inputs'])){
  8.         $tInputs=$_POST['t_inputs'];
  9.         echo '<table cellpadding="5" cellspacing="0" align="center" border="0">';
  10.         for($i=1; $i<=$tInputs; $i++){
  11.             echo '<tr>
  12.                     <td valign="middle">Column Name&nbsp;'.$i.'</td>
  13.                     <td valign="middle"><input type="text" name="column_name_'.$i.'" id="column_name_'.$i.'" value="" /></td>
  14.                 </tr>
  15.                 ';
  16.         }
  17.         echo '</table>';
  18.     }
  19. ?>
  20.  
Dec 17 '09 #1

✓ answered by omerbutt

i got it it was just because the HTML was not up to the standards and the form was populated inside the table instead of the td due to which it abnormally closed the form before the inputs div its working now

1 2082
omerbutt
638 512MB
i got it it was just because the HTML was not up to the standards and the form was populated inside the table instead of the td due to which it abnormally closed the form before the inputs div its working now
Dec 17 '09 #2

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

Similar topics

8
by: dmcconkey | last post by:
Hi folks, I have a client with four websites. Each site has a contact form that is identical. They all have "required" fields validated through a JavaScript onSubmit() function. Upon validation,...
2
by: Cerebral Believer | last post by:
Hi folks, Can anyone help me with this form: http://futurebydesign-music.com/_member/club_fbd_reg.php I have followed to coding instructions aas closely as I can, but I am getting errors...
4
by: Greg Scharlemann | last post by:
I'm trying to setup a dyamic dropdown list that displays a number of text fields based on the selected number in the dropdown. The problem I am running into is capturing the data already entered...
2
ak1dnar
by: ak1dnar | last post by:
Hi, please help me on this. Here i am having a simple form that consist with name and email fields and both are required fields. i am going to validate this inputs using validate.php. but since i...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
17
by: Johnny BeGood | last post by:
Hi All, Is there a way to post the contents of a form without having to click on the Submit button, i.e <form method="post" action="http://www.whereever.com/ProcessTheData.php"> <INPUT...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
12
by: colt28 | last post by:
Ok so I found an ajax contact form script but i can't get the b****** to work. I made a bunch of alterations to it and it didn't work so i replaced everything with the original and it still didn't...
61
by: bonneylake | last post by:
Hey Everyone, Well after asking many questions i have this almost working. This is how it works. Basically i fill in my customer number field an that populates my drop down box. Once i select...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...

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.