I am trying to get this form to add a distribution line on demand. However, when I click on the 'anotherdistribution' button, I know it is executing the code in moreFields, but it doesn't actually display the fields in the form in the node. Anyone see anything that I am missing?


<div id='readdist' style='display:none' >
<td width=10>&nbsp;</td>
<td colspan=4>&nbsp;</td>
<td>* New</td>
<td><input name='newamtnew' style='text-align: right' />
<input type='button' value='Remove Distribution' 
<form name='htmlrginputform' method=post action=Post>
<table width=100%>
<tr bgcolor=#DDDDEE>
<td><h2><font color=#3333CC>Distibution</font></h2></td>
<table width=100% border=1>
<tr><td width=50% colspan=5>&nbsp;</td>
<td width=10%>Stop</td>
<td>New Amount/Information</td>

<div><span id='writedist'></span></div>

<input type='button' value='Add New Distribution' id='anotherdistribution' onclick='moreFields();' />

<script language='Javascript'>
  function moreFields() {
    var newFields = document.getElementById('readdist').cloneNode(true);
    newFields.id = '';
    newFields.style.display = 'block';
    var insertHere = document.getElementById('writedist');
    var parentDiv = insertHere.parentNode;
8 Years
Discussion Span
Last Post by hielo

your problem is because your HTML markup is INVALID. For example, find your first <TR> element. You have not stated where the <TABLE> begins!

Here's another example. If you were to add <table> to fix the problem I mentioned above, then you have: <div><span id='writedist'></span></div> as a child of <table> . A <table> tag cannot have a <div> as a child. You need to put that <div> into a <td> , but that <td> needs to be in a <tr> Go to http://validator.w3.org, and click on "Validate by direct input", then paste your html. Fix all the errors outlined there and then your page should work.

Edited by hielo: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.