Hey Everyone,
Well i was hoping someone could explain the best way i could go about this.
i have a few ideas on how i could go about this but i am just not sure if it would work.
Right now i have a form where you can add and delete multiple serial information. This works wonderful. But now for every serial information i add i need to be able to add and remove multiple parts to that serial.
heres an example of what i mean
serial information 1
parts 1
parts 2
serial information 2
parts 1
parts 2
The thing is if one of the serial information's gets deleted all the parts associated with it also have to be able to be removed with it as well. So if anyone could explain the best way to do this i would very much appreciate it.Here is the code i currently have for it. This allows you to add multiple serials.
Thank you in advance,
Rach
Well i was hoping someone could explain the best way i could go about this.
i have a few ideas on how i could go about this but i am just not sure if it would work.
Right now i have a form where you can add and delete multiple serial information. This works wonderful. But now for every serial information i add i need to be able to add and remove multiple parts to that serial.
heres an example of what i mean
serial information 1
parts 1
parts 2
serial information 2
parts 1
parts 2
The thing is if one of the serial information's gets deleted all the parts associated with it also have to be able to be removed with it as well. So if anyone could explain the best way to do this i would very much appreciate it.Here is the code i currently have for it. This allows you to add multiple serials.
Code:
<!---Allows us to add serial information multiple times ---> <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: </td>" + "</td>" + "<td>" + "<select name='modelno_" + count + "' >" + "<option value=''>Make A Selection</option>" + "<cfoutput query='models'>" + "<option value='#model#'>#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#'>#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#'>#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: " + "<input type='text' name='serialnum_" + count + "'>" + " Software/Hardware: " + "<select name='softhardware_" + count + "'>" + "<option value='' selected>No Choice</option>" + "<cfoutput query='getSoftHard'>" + "<option value='#pk_softwareHardware#'>#pk_softwareHardware#</option>" + "</cfoutput>" + "</select>" + "</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: " + "</td>" + "<td class='descriptionmoveinmulti'>" + "( You may enter up to 1000 characters. )"+ "<br>" + "<textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></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: " + "</td>" + "<td class='resolutionmoveinmulti'>" + "( You may enter up to 1500 characters. )"+ "<br>" + "<textarea maxlength='1500' onkeyup='return resolutionmaxlength(this)' onkeydown='return resolutionmaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'></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: (MM/DD/YYYY) " + "</td>" + "<td>" + "<input type='text' name='resdate_" + count + "' value='' > " + " Current Date: " + "<input type='checkbox' name='currentdateresol_" + count + "' onClick=resdate_" + count + ".value=fill_date()>" + "</td>" + "<td>" + "Resolution Verified as effective by: " + "</td>" + "<td>" + "<select name='resvertified_" + count + "'>" + "<option value='' selected>Make A Selection</option>" + "<cfoutput query='gettech'><option value='#fname# #lname#'>#fname# #lname#</option></cfoutput>" + "</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: (MM/DD/YYYY) " + "</td>" + "<td class='vertificationmoveinmulti'>" + "<input type='text' name='vertifidate_" + count + "'> " + " Current Date: " + "<input type='checkbox' name='currentdatevert_" + count + "' onClick=vertifidate_" + count + ".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*: " + "<select name='deptvendor_" + count + "'>" + "<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: " + "</td>" + "<td class='rmanmoveinmulti'>" + "( You may enter up to 1000 characters. )"+ "<br/>" + "<textarea maxlength='1000' onkeyup='return rmamaxlength(this)' onkeydown='return rmamaxlength(this)' rows='4' cols='60' name='rma_" + count + "'></textarea> " + "</td>" + "</tr>" + "</table>" + "<input type='hidden' name='serialcount' value='" + count + "'>"; <!--- 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 ""+count +""' 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> <!--- Ticket Information ---> <input type="hidden" value="0" id="theValue" /> <div id="dynamicInput"> <!--- All Ticket Information Appears Here---> </div> <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" > </form>
Thank you in advance,
Rach
Comment