Here is the form i am working with.

<!--- Adds Multiple Ticket fields --->
<script type="text/javascript">

<!---Allows us to add multiple fields --->
function addInput(divName){
var dynamic = document.getElementById('dynamicInput');
var thevalue = document.getElementById('theValue');
var count = (document.getElementById('theValue').value -1)+ 2;
thevalue.value = count;
var newdiv = document.createElement('div');
var divIdName = 'dynamic'+count+'Input';
newdiv.setAttribute('id',divIdName);

<!--- Adds Extra fields for Model No, Product Type, and Type of Hardware 
Failure  --->
newdiv.innerHTML = 
"<table class='zpExpandedTable' id='modeltable'>" + 
"<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" 
+ 
"<tr>" + 
"<td id='paddingformultitop'>Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>" + 
"</td>" + 
"<td>" +
 "<select name='modelno' >" + 
 "<option value=''>Make A Selection</option>" + 
  "<option value='Test'>Test</option>"+
 "</select>" + 
 "</td>" + 
 "<td>" +
"&nbsp;&nbsp;&nbsp;&nbsp;Product Type:"  + 
"</td>" +
"<td>" +
"<select name='producttype'>" + 
"<option value='' selected>No Choice</option>" + 
"<cfoutput query='getProdType'>" + 
"<option value='#pk_productType#'>#pk_productType#</option>" + 
"</cfoutput>" + 
"</select>" + 
"</td>" + 
"<td class='red'>" +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type
 Of Hardware Failure*:" + 
"</td>" +
"<td>" +
"<select name='hardwarefailure'>" + 
"<option value='' selected>Make A Selection</option>" + 
"<cfoutput query='getHardwareFail'>" +
"<option value='#pk_hardwareFailure#'>#pk_hardwareFailure#</option>" +
"</cfoutput>" +
"</select>" + 
"</td>" +
"</tr>" +
"<table>";

<!--- Adds Extra fields for Serial Number and Software/Hardware  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='modeltable'>" +
"<tr>" +
"<td id='paddingformultitop'>" +
"Serial Number:&nbsp;&nbsp;" + 
"<input type='text' name='serialnum'>" + 
"&nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;" + 
"<input type='text' name='softhardware'>" +
"</td>" +
"</tr>" +
"</table>";

<!--- Adds Extra fields for Description  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='resoltable' cellpadding='3' 
cellspacing='0'>" +
"<tr>" +
"<td id='paddingformutli'>" +
"Description:&nbsp;&nbsp;" + 
"</td>" +
"<td class='descriptionmoveinmulti'>" +
"( You may enter up to 500 characters. )"+
"<br>" +
"<textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return 
ismaxlength(this)'rows='4' cols='60' name='description'></textarea>" + 
"</td>" +
"</tr>" +
"</table>";

<!--- Adds Extra fields for Resolution  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' 
cellspacing='0'>" +
"<tr>" +
"<td id='paddingformutli'>" +
"Resolution:&nbsp;&nbsp;" + 
"</td>" +
"<td class='resolutionmoveinmulti'>" +
"( You may enter up to 500 characters. )"+
"<br>" +
"<textarea  maxlength='500' onkeyup='return ismaxlength(this)' 
onkeydown='return ismaxlength(this)' rows='4' cols='60' 
name='resolution'></textarea>" + 
"</td>" +
"</tr>" +
"</table>";

<!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) 
and resolution vertified as effective by  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' 
cellspacing='0'>" +
"<tr>" +
"<td id='paddingformultitop'>" +
"Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" + 
"</td>" +
"<td>" +
"<input type='text' name='resdate' value=''  >&nbsp;&nbsp;" + 

"&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" + 
"<input type='checkbox' name='currentdateresol' id='currentresdate' 
onClick=resdate.value=fill_date()>" + 
"</td>" +
"<td>" +
"Resolution Verified as effective by:&nbsp;&nbsp;"  + 
"</td>" +
"<td>" +
"<select name='resvertified'>" + 
"<option value=''>Make A Selection</option>" + 
"</select>" + 
"</td>" +
"</tr>" +
"</table>";

<!--- Adds Extra fields for Vertification Date, Current Date (for vertification 
date) and resolution vertified as effective by  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' 
cellspacing='0'>" +
"<tr>" +
"<td id='paddingformultitop'>" +
"Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" + 
"</td>" +
"<td class='vertificationmoveinmulti'>" +
"<input type='text' name='vertifidate'>&nbsp;&nbsp;" + 
"&nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;" + 
"<input type='checkbox' name='currentdatevert' 
onClick=vertifidate.value=fill_date()>" + 
"</td>" +
"</tr>" +
"</table>";

<!--- Adds Extra fields for Dept/Vendor Responsibility  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' 
cellspacing='0'>" +
"<tr>" +
"<td class='red' id='paddingformultitop'>" +
"Dept/Vendor 
Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  + 
"<select name='deptvendor'>" + 
"<option value='' selected>Make A Selection</option>" + 
"<cfoutput query='getDeptVendor'>" +
"<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" +
" </cfoutput>" +
"</select>" + 
"</td>" +
"</tr>" +
"</table>";

<!--- Adds Extra fields for RMA Data Only  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' 
cellspacing='0'>" +
"<tr>" +
"<td id='paddingformultitop'>" +
"RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;" + 
"</td>" +
"<td class='rmanmoveinmulti'>" +
"( You may enter up to 500 characters. )"+
"<br/>" +
"<textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return 
ismaxlength(this)' rows='4' cols='60' name='rma'></textarea> " + 
"</td>" +
"</tr>" +
"</table>";

<!--- Adds Delete to every ticket  --->
newdiv.innerHTML = newdiv.innerHTML + 
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' 
cellspacing='0'>" +
"<tr>" +
"<td>" +
"<input type='button' class='removeticket' value='Remove Serial &quot;"+count 
+"&quot;' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
"</td>" +
"</td>" +
"</tr>" +
"</table>";

document.getElementById(divName).appendChild(newdiv);
}  

<!---Allows us to remove multiple fields --->
function removeElement(divNum) {
  var d = document.getElementById('dynamicInput');
  var olddiv = document.getElementById(divNum);
  d.removeChild(olddiv);
}

</script>

<form action="userform.cfm" id="userForm"  name="userForm" method="POST" >
<div action="javascript:get(document.getElementById('updateform1'));" 
name="updateform1" id="updateform1" onButton="return formvalidate()" >
<input type="hidden" name="ID" id="ID" value="#insertticketmaster.ID#" />
<input type="hidden" value="0" id="theValue" />
  <div id="dynamicInput">
     <!--- All Ticket Information thats in javascript Appears Here--->
     </div>
<input type="button" class="addticket" value="Add Serial" 
onClick="addInput('dynamicInput');">
<input type="submit" class="officalsubmit" value="Submit" onClick="return 
validate_form();">
</form>

Alrighty well here is my form. I know its a lot an its messy. which sorry its a 
mess, just only way i was able to accomplish what i am doing. 

But let me explain it. All the javascript does is add the remove multiple 
fields.As you will see all of my fields that go into the form are in the 
javascript. Basically what i am doing is when i click add serial i am able to 
add multiple forms to fill in. In this case if a customer calls an they are 
having problems with multiple computers they need to be able to fill out 
multiple serials an it all go under one ticket (they will adventually be able 
to go back an look at all the information to make updates on how the customers 
product is doing an such), which that part works great an no problem. When you 
get to the form part you will see it posts to another file which is all my 
database stuff that i posted earlyer. 

Basically the problem i am having is once i click submit an all that 
information goes into the database is when i have the problem. i have no 
problems if i add only one serial, but if i try to add 2 or more is when i run 
into the problem. With the counter, it seems whatever i write to the first 
serial ends up being applied to the second serial instead of what i original 
put in the second serial.
An i also know i am going to eventually run into another problem. If i fill in 
3 serials an lets say i did it this way where i have
serial no: 123 ticket no: 5 model_no: test
serial no: 456 ticket no: 5 model_no: 
serial no: 789 ticket no: 5 model_no; test 2

if i don't have a value in model_no for serial 456. the model no for 789 will 
go into serial 456 and the serial no 789 model no will have no value. I am 
still trying to figure out this problem as well. i have thought about putting a 
default value in my database, by modifying my table an setting a default value, 
but when i tried that for some reason it is not putting it into my table, i 
probably did something wrong. An i have also thought about putting a default 
value in my stored procedure an well when i did that it put the value i 
assigned an the default value, which is no good.

 But sorry this is so long an thank you for all your help i really do 
appreciate it. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309142
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to