Hey Everyone,
Well i keep getting the error that addInput is not defined but i can not figure out what is wrong with it. It worked perfectly fine when i was using it to submit data. But now that i am trying to make it display previously entered data it says addInput is not defined. could really use an idea on whats wrong with it because i can't figure it out.
here is what i have
javascript
heres the form
Thank you in advance,
Rach
Well i keep getting the error that addInput is not defined but i can not figure out what is wrong with it. It worked perfectly fine when i was using it to submit data. But now that i am trying to make it display previously entered data it says addInput is not defined. could really use an idea on whats wrong with it because i can't figure it out.
here is what i have
javascript
Code:
<script type="text/javascript">
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);
newdiv.innerHTML =
"<table class='zpExpandedTable' id='modeltable'>" +
"<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" +
"<tr>" +
"<td id='paddingformultitop'>Model No: </td>" +
"</td>" +
"<td>" +
"<select name='modelno_" + count + "'>" +
"<option value=''>Make A Selection</option>" +
"<cfoutput query='models'>" +
"<option value='#model#'<cfif #model# is #model_no#>selected</cfif>>#model#</option>" +
"</cfoutput>" +
"</select>" +
"</td>" +
"<td>" +
" Product Type:" +
"</td>" +
"<td>" +
"<select name='producttype_" + count + "'>" +
"<option value='' selected>No Choice</option>" +
"<cfoutput query='getProdType'>" +
"<option value='#pk_productType#'<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option>" +
"</cfoutput>" +
"</select>" +
"</td>" +
"<td class='red'>" +
" Type Of Hardware Failure*:" +
"</td>" +
"<td>" +
"<select name='hardwarefailure_" + count + "'>" +
"<option value='' selected>Make A Selection</option>" +
"<cfoutput query='getHardwareFail'>" +
"<option value='#pk_hardwareFailure#'<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>" +
"</cfoutput>" +
"</select>" +
"</td>" +
"</tr>" +
"<table>";
newdiv.innerHTML = newdiv.innerHTML +
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
"<tr>" +
"<td>" +
"<input type='button' class='removeticket' value='Remove Serial ""+count +""' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
"</td>" +
"</td>" +
"</tr>" +
"</table>";
document.getElementById(divName).appendChild(newdiv);
}
function removeElement(divNum) {
var d = document.getElementById('dynamicInput');
var olddiv = document.getElementById(divNum);
d.removeChild(olddiv);
}
</script>
heres the form
Code:
<body onload="addInput('dynamic');">
<form action="userformedit.cfm" id="userForm" name="userForm" method="POST" enctype="multipart/form-data" onclick="multipleSelectOnSubmit();">
<input type="hidden" value="0" id="theValue" />
<div id="dynamicInput">
</div>
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
<input type="submit" value="submit" name="submit">
</form>
</body>
Rach
Comment