Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Dynamic Form Problem....
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

The Omega
New Member

55 Posts

Posted - 07 May 2005 :  22:09:52  Show Profile
I have a set of dynamic form fields in a table that I need to have shown and perhaps repeated depending on how many times the button is clicked. I have the script to do it and it works except the form fields are not renamed with the counter appended on the end. It renames the TD tag names instead of the INPUT tag name attribute.

Javascript to replicate the fields:
<script language="JavaScript">
var counter = 0;
function AdditionalHAWB()
{
	counter++;
	var newFields = document.getElementById('AddHAWB').cloneNode(true);
	newFields.id = '';
	newFields.style.display = 'block';
	var newField = newFields.childNodes;
	for (var i=0;i<newField.length;i++)
	{
		var theName = newField[i].name
		if (theName)
			newField[i].name = theName + counter;
			alert (theName + counter);
	}
	var insertHere = document.getElementById('ShowAdditionalHAWB');
	insertHere.parentNode.insertBefore(newFields,insertHere);
}
</script>

Hidden Section that is unhidden and is repeated:
"<table width=""100%"" border=""0"" id=""HAWBtbl"">" & vbNewLine & _
									   "<tr style=""display: none"" id=""addHAWB"">" & vbNewLine & _
											"<td width=""25%"" name=""frmDispatchHAWB_"">" & vbNewLine & _
							 					"<input SIZE=""20"" name=""frmDispatchHAWB"" maxlength=""20"" " & EnterToTab & " autocomplete=""off"">" & vbNewLine & _
							 				"</td>" & vbNewLine & _
							 				"<td width=""25%"" name=""frmDispatchMove_"">" & vbNewLine & _
							 					"<input SIZE=""15"" name=""frmDispatchMove"" maxlength=""40"" " & EnterToTab & " autocomplete=""off"">" & vbNewLine & _
							 				"</td>" & vbNewLine & _
											"<td width=""25%"" name=""frmDispatchBoL_"">" & vbNewLine & _
												"<input SIZE=""20"" name=""frmDispatchBoL"" maxlength=""40"" " & EnterToTab & " autocomplete=""off"">" & vbNewLine & _
											"</td>" & vbNewLine & _
							 				"<td width=""25%"" name=""frmDispatchAWB_"">" & vbNewLine & _
												"<input SIZE=""10"" name=""frmDispatchAWB"" maxlength=""40"" " & EnterToTab & " autocomplete=""off"">" & vbNewLine & _
											"</td>" & vbNewLine & _
										"</tr>" & vbNewLine & _
										"<tr id=""ShowAdditionalHAWB""></tr>" & vbNewLine & _
									"</table>" & vbNewLine & _
									"<table width=""100%"" border=""0"">" & vbNewLine & _
									  "<tr>" & vbNewLine & _
										  "<td colspan=""4"">" & vbNewLine & _
									 		  "<div align=""right""><input type=""button"" value=""Additional Bills"" onClick=""AdditionalHAWB()""> </div>" & vbNewLine & _
											"</td>" & vbNewLine & _
										"</tr>" & vbNewLine & _
									"</table>" & vbNewLine & _


Thanks in advance for whatever help you all can give me....
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.36 seconds. Powered By: Snitz Forums 2000 Version 3.4.07