form not identifying the new input fields generated through a javascript

Posted by tibin mathew on Stack Overflow See other posts from Stack Overflow or by tibin mathew
Published on 2010-05-05T07:41:23Z Indexed on 2010/05/05 8:18 UTC
Read the original article Hit count: 255

Filed under:
|
|

Hi,

I am developing a site in php.

i have some issues with my form

i have to more than one software packages at a time.

so i have used javascript to append file and a dropdown to my html.

i have called ajs function to add the new input fields each time when i click a link.

and its displaying correctly.

but its not identifying in my action page.

i cant take the value of new input fields which i have created through that javascript function.

below is the code page which i have used.

function addInput(divName){ var newsel= document.createElement('div'); newsel.innerHTML="Operating System: --Select OS--    bc_linux    Linux   Solaris   2000/XP/Vista   XP/Vista   2K/XP/Vista/W7   HP   Windows 2000/XP/Vista zip   Windows 2000/XP/Vista exe   X Server - 2.2M   Fonts - 32.9M"; document.getElementById(divName).appendChild(newsel); var newdiv = document.createElement('div'); newdiv.innerHTML = "Upload Software File: "; document.getElementById(divName).appendChild(newdiv); }

                                      <form action="act-add-software.php" method="post" onSubmit="return validate(this);" enctype="multipart/form-data">

 Operating System:  Operating System:

                                              <select name="frm_os"  class="text_area" style="width:200px">
                                                    <option value="">--Select OS--</option>
                                                        <optgroup label="Spind Enabled"> </optgroup>
                                                        <option value="bc_linux">&nbsp;&nbsp;&nbsp;bc_linux</option>
                                                        <optgroup label="Packages"> </optgroup>
                                                        <option value="Linux">&nbsp;&nbsp;&nbsp;Linux</option>
                                                        <option value="Solaris">&nbsp;&nbsp;&nbsp;Solaris</option>
                                                        <option value="2000/XP/Vista">&nbsp;&nbsp;&nbsp;2000/XP/Vista</option>
                                                        <option value="XP/Vista">&nbsp;&nbsp;&nbsp;XP/Vista</option>                                                            
                                                        <option value="2K/XP/Vista/W7">&nbsp;&nbsp;&nbsp;2K/XP/Vista/W7</option>                                                            
                                                        <option value="HP">&nbsp;&nbsp;&nbsp;HP</option>                                                            
                                                        <option value="Windows 2000/XP/Vista zip">&nbsp;&nbsp;&nbsp;Windows 2000/XP/Vista zip</option>                                                          
                                                        <option value="Windows 2000/XP/Vista exe">&nbsp;&nbsp;&nbsp;Windows 2000/XP/Vista exe</option>
                                                        <option value="X Server - 2.2M">&nbsp;&nbsp;&nbsp;X Server - 2.2M</option>
                                                        <option value="Fonts - 32.9M">&nbsp;&nbsp;&nbsp;Fonts - 32.9M</option>                                                                                                                                                                                  
                                                        </select>
                                                        <a onClick="addInput('dynamicInput');">Add More Package</a> </td>
                                              </td>
                                            </tr>
                                            <tr>
                                              <td colspan="2"><table border="0" cellpadding="0" cellspacing="0">
                                                  <tr align="center" valign="middle" class="tbl_row1">

                                                    <td height="25" align="left" class="font1" width="156" bgcolor="White"><div align="right">
                                                        <?if(strstr($frm_server_side_error,'frm_software')){?>
                                                        <font class="error"><b> <font color="#dd0000">*</font>&nbsp;Upload Software File: </font>
                                                        <?}else{?>
                                                        <font class="form_element"> <font color="#dd0000">*</font>&nbsp;Upload Software File:
                                                        <?}?>
                                                      </div>
                                                      </B> </td>

                                                    <td  class="font1"  bgcolor="White" align="center" style="padding-left:2px;"><input type="file" name="frm_image[]" class="text_area">
                                                    </td>
                                                    <?if($frm_sfile !=""){?>
                                                    <td  class="font1"  bgcolor="White" align="center"></td>
                                                    <?}else{?>
                                                    <td  class="font1"  bgcolor="White" align="center">&nbsp;(Current File: NOT Uploaded Yet) </td>
                                                    <?}?>
                                                  </tr>
                                                </table></td>
                                            </tr>

                                            <tr>
                                            <td colspan="2">
                                            <div id="dynamicInput">
                                            </div>
                                            </td>
                                            </tr>

                                            <? if(isset($_REQUEST['edit'])){?>
                                            <tr>
                                              <td colspan="2"><table border="0" cellpadding="0" cellspacing="0">
                                                  <tr align="center" valign="middle" class="tbl_row1">
                                                    <td height="25" align="left" class="font1"  width="156" bgcolor="White"><div align="right">&nbsp;Upload Version TXT File: </div>
                                                      </B> </td>
                                                    <td  class="font1"    bgcolor="White" align="right" style="padding-left:2px;"><input type="file" name="frm_version_txt" class="text_area">
                                                    </td>
                                                    <?if($frm_vers_txt !=""){?>
                                                    <td  class="font1"   bgcolor="White" align="center">&nbsp;(Current File: <?echo $frm_vers_txt;?>) </td>
                                                    <?}else{?>
                                                    <td  class="font1"   bgcolor="White" align="center">&nbsp;(Current File: NOT Uploaded Yet) </td>
                                                    <?}?>
                                                  </tr>
                                                </table></td>
                                            </tr>
                                            <?}?>
                                            <tr><td colspan="2" height="5" ></td></tr>
                                                <tr>
                                                    <td align="right" width="30%" style="font-size:13px;color:#000000;" colspan="2"><div align="left"><font color="#dd0000">&nbsp;&nbsp;&nbsp;*</font> Asterisks denote required fields&nbsp;&nbsp;</div></td>
                                                </tr>
                                                <tr><td colspan="2" height="5" ></td></tr>
                                                <tr>
                                                    <td align="right" width="30%" style="font-size:13px;color:#000000;" colspan="2"><div align="left"><font color="#dd0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>Note: Only one software can be uploaded per Operating System for a particular version. </div></td>
                                                </tr>




                                            <tr>
                                              <td colspan="2" height="5" ></td>
                                            </tr>

                                            <tr valign="middle" bgcolor="White">
                                              <td nowrap colspan="2"><div align="center">
                                                <table>
                                                <tr>
                                                  <input type="hidden" name="like" value="<?=$sub_like?>">
                                                  <input type="hidden" name="offset" value="<?=$offset?>">
                                                  <input type="hidden" name="edit" value="<?=$faq_id?>">
                                                  <input type="hidden" name="add" value="<?=$_REQUEST[add]?>">
                                                  <input type="hidden" name="ex_np_link" value="<?=$ex_np_link?>">
                                                  <input type="hidden" name="frm_group_show" value="<?=$frm_bc?>">
                                                  <input type="hidden" name="frm_pd_id" value="<?=$pdct_id?>">
                                                    <input type="hidden" name="count_val" value="1" id="id_count">
                                                  <!-- <input type="hidden" name="frm_pdct" value="<?=$pdct_id?>">
                                                  <input type="hidden" name="frm_dname" value="<?=$frm_question?>">
                                                  <input type="hidden" name="frm_date_created" value="<?=$edit_created_date?>"> -->
                                                  <input type="hidden" name="frm_txt_else" value="<?=$frm_vers_txt?>">




                                      </tr>

                                    </table>
                                  </div>

                                  </td>

                                  </tr>




                                </table>
                              </div>

                              </td>

                              <th background="../admin_images/bg4.jpg" style="background-repeat:repeat-y "scope="row"></th>
                              </tr>

                              <tr>
                                          <th width="3%" background="../admin_images/bg8.jpg" style="background-repeat:repeat-y "scope="row">&nbsp;</th>
                                          <td colspan="2"  style="padding-left:5px;padding-bottom:1px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                              <tr>

                                                <td colspan="2" valign="top"><div align="right">
                                                    <table border="0">
                                                      <tr>
                                                        <td vAlign="right" title="Save">&nbsp;
                                                          <input type="Image" src="./../admin_images/save.jpg" name="btn_submit" value="<?=$btn_value?>" onClick="return validate(this.form);">


                                                        </td>
                                                        <td title="Cancel"><a href="manage-software.php?field_name=SUnq&sort_meth=<?=$sort_meth?>&like=<?=$sub_like?>&offset=<?=$offset?>&frm_group_show=<?=$frm_bc?>"><img src="./../admin_images/cancel.jpg" border="0" align="absmiddle"></a></td>
                                                        <input type="hidden" name="like" value="<?=$sub_like?>">
                                                        <input type="hidden" name="offset" value="<?=$offset?>">
                                                      </tr>
                                                    </table>
                                                  </div></td>
                                              </tr>
                                            </table></td>
                                          <th background="../admin_images/bg4.jpg" style="background-repeat:repeat-y "scope="row"></th>
                                        </tr>
                                          </form>

For the simplicity of viewing this code page i have included only required code lines

please help me to solve this issue

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript