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
92 4338
Add the parts within the serial div, so when you remove the div everything within it is deleted including the parts.
Add the parts within the serial div, so when you remove the div everything within it is deleted including the parts.
Hey Acoder,
Well the thing is i am inserting an not just trying to display the parts. An the way i am inserting i don't have anything between the div like so - <!--- 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');" >
-
an they also want to make it for every serial they add they want to make it so they can add multiple parts per serial. I had the idea of taking the function i have now an making a copy of it, change a few words so they don't get each other confused an then put the new function within the old function. that way it could add and remove fields but i am not sure that would work.Could i do it that way?
Thank you,
Rach
I meant to add the parts to the serial div as you've done with serial (appending to dynamicInput). If you want to add and remove parts individually, you can create two functions similar to what you have for serials.
[quote=acoder]I meant to add the parts to the serial div as you've done with serial (appending to dynamicInput). If you want to add and remove parts individually, you can create two functions similar to what you have for serials.[/QUOTE
Hey Acoder,
The only thing i am not understanding is the appending to the dynamicInput. Are you saying when i create my new function to put the new function within the dynamic input like so - <input type="hidden" value="0" id="theValue" />
-
<div id="dynamicInput">
-
<div id="parts"></div>
-
<!--- All Ticket Information Appears Here--->
-
</div>
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
here is what i have so far for parts but i keep getting the error addpartInput undefined but yet i have not even gotten to see the parts show up yet. Here is what i have
the javascript -
<!---PARTS--->
-
<script type="text/javascript">
-
<!---Allows us to add multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById('partsInput');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'parts'+count+'Input';
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields parts table --->
-
partdiv.innerHTML =
-
"<table class='createticketables' id='spaceup'>" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table class='createticketables' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput><option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>
-
</select><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>
the form - <html>
-
<body onload="addInput('dynamicInput');addpartInput('partsInput');">
-
<form>
-
<input type="hidden" value="0" id="theValue" />
-
<input type="hidden" value="0" id="aValue" />
-
<div id="dynamicInput">
-
<div id="partsInput">
-
<!--- All Ticket Information Appears Here--->
-
</div>
-
</div>
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
-
</form>
-
</body>
-
</html>
Thank you,
Rach
Hey Acoder,
Ok i got the parts information showing up. An i don't get the error like i described above anymore. However, i am still having trouble.
Right now when the page loads it puts the part information on top of the serial information. When i click add part it adds the part underneath the first part that loads. When i click on add serial it puts the serial underneath the previous serial.
What i am trying to do is this
serial information
parts 1
parts 2
serial information 2
parts 1
parts 2
basically its positioning that i am having problems on. Any ideas? here is what i have
the html -
<body onload="addInput('dynamicInput');addpartInput('partsInput');">
-
<!--- Ticket Information --->
-
<input type="hidden" value="0" id="theValue" />
-
<input type="hidden" value="0" id="aValue" />
-
<div id="dynamicInput">
-
<div id="partsInput">
-
<!--- All Ticket Information Appears Here--->
-
</div>
-
</div>
-
<input type="button" class="addticket" value="Add Parts" onClick="addpartInput('partsInput');" >
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
the serial and parts javascript
Thank you,
Rach
Remove the partInput div from the HTML and create the div dynamically using createElement (as you've done in addInput) in addpartInput.
Remove the partInput div from the HTML and create the div dynamically using createElement (as you've done in addInput) in addpartInput.
Hey Acoder,
I am confused on what you mean. Because thought i already did that using this for parts. are you saying i need to create a 3rd one? - function addpartInput(partName){
-
var parts = document.getElementById('partsInput');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'parts'+count+'Input';
-
partdiv.setAttribute('id',partIdName);
Thank you,
Rach
Actually, thinking about this again, it would make more sense for you to create a parts div in addInput when you create the serial. Give it a unique ID based on the serial div id. Then in addpartInput, get this div and add to it.
Actually, thinking about this again, it would make more sense for you to create a parts div in addInput when you create the serial. Give it a unique ID based on the serial div id. Then in addpartInput, get this div and add to it.
Hey Acoder,
i am still lost by what you mean.
here is what i tried in the serial function. i added the line var getparts - 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 getparts = document.createElement('div');
-
var divIdName = 'dynamic'+count+'Input';
-
newdiv.setAttribute('id',divIdName);
here is what i tried in the parts function trying to get the line get parts - function addpartInput(partName){
-
var parts = document.getElementById('partsInput');
-
var getparts = document.createElement('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('thediv');
-
var partIdName = 'parts'+count+'Input';
-
partdiv.setAttribute('id',partIdName);
Thank you,
Rach
To get a div, you use document.getElementById(id). If parts always appear after the serial information, then you don't even need a parts parent div, you can just append after the serial info. using appendChild on the serial div, dynamic1input, dynamic2input, etc.
To get a div, you use document.getElementById(id). If parts always appear after the serial information, then you don't even need a parts parent div, you can just append after the serial info. using appendChild on the serial div, dynamic1input, dynamic2input, etc.
Hey Acoder,
I am lost on not needing a parts parent div. It should appear after serial information. But the thing is it going to appear after multiple serials like so
serial information 1
parts 1
parts 2
parts 3
serial information 2
parts 1
parts 2
parts 3
an this is how you get the id correct?
parts function - function addpartInput(partName){
-
var parts = document.getElementById('partsInput');
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('thediv');
-
var partIdName = 'parts'+count+'Input';
-
partdiv.setAttribute('id',partIdName);
-
Thank you,
Rach
Let me explain. You initially have: - <div id="dynamicInput">
-
</div>
Now in addInput, you add a div with ID "dynamic1Input" containing the serial information. Let's say you create another serial, so you have two serials: - <div id="dynamicInput">
-
<div id="dynamic1Input">
-
<!-- serial info here -->
-
</div>
-
<div id="dynamic2Input">
-
<!-- serial info here -->
-
</div>
-
</div>
If you just append the parts for serial 1 to dynamic1Input using appendChild(), it will appear below serial 1, but before serial 2, and if you delete serial 1, all the corresponding parts will automatically be deleted.
Hey Acoder,
Ok i got what your saying an thats working how you described it. But i got a bigger challenge to this. Is there anyway that if i have 3 multiple serials open. That i could make it where no matter if 3 serials are open or not that instead of adding it to the last serial that i choose to add that i could add a button within each serial and click add parts an it adds the part underneath that serial
heres an example
serial information 1
(add parts) if click add will add the parts under here
serial information 2
(add parts) if click add will add the parts under here
serial information 3
(add parts) if click add will add the parts under here
but here is html -
<input type="hidden" value="0" id="theValue" />
-
<input type="hidden" value="0" id="aValue" />
-
<div id="dynamicInput">
-
-
</div>
-
<!--- All Ticket Information Appears Here--->
-
-
<input type="button" class="addticket" value="Add Parts" onClick="addpartInput('dynamicInput');" >
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
-
heres the javascript for serial
javascript for parts -
<!---PARTS--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById('dynamicInput');
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('thediv');
-
var partIdName = 'dynamic'+count+'Input';
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
"<table class='createticketables' id='spaceup'>" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table class='createticketables' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields --->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
d.removeChild(olddiv);
-
}
-
-
</script>
Thank you,
Rach
Yes, that's what I had in mind anyway. What you need to do is to create a button inside each serial div in addInput(). This would appear at the end of each serial information display. Just copy and modify the code that creates buttons.
You need to append to each serial div, not the main "dynamicInput" div, so the ID passed to addpartInput() needs to be "dynamic1Input", "dynamic2Input", etc. but that shouldn't be a problem because the button is created inside addInput which has the variable you need - divIdName.
Yes, that's what I had in mind anyway. What you need to do is to create a button inside each serial div in addInput(). This would appear at the end of each serial information display. Just copy and modify the code that creates buttons.
You need to append to each serial div, not the main "dynamicInput" div, so the ID passed to addpartInput() needs to be "dynamic1Input", "dynamic2Input", etc. but that shouldn't be a problem because the button is created inside addInput which has the variable you need - divIdName.
Hey Acoder,
I thought i fully understood but i somehow got lost in the process. When i moved the button from being under the <div id="dynamicInput"></div>. the button now does not want to work. I put it under the delete button in the serial function. Not sure what i did wrong. - <!--- 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>" +
-
"<input type='button' class='addticket' value='Add Parts'
-
onClick='addpartInput('dynamicInput');' >" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
an then on the append here is what i have for the serial append - document.getElementById(divName).appendChild(newdiv);
and here is what i have for the parts append - document.getElementById(partName).appendChild(partdiv);
are you saying to change the getElementById in the parts append to the one in the serial append?
Thank you,
Rach
See how you've added the button for "remove serial" on line 6 just above the parts button. Use something similar otherwise the code you currently have will result in errors from unescaped quotes.
See how you've added the button for "remove serial" on line 6 just above the parts button. Use something similar otherwise the code you currently have will result in errors from unescaped quotes.
Hey Acoder,
This is what i did but do i need to change the dynamicInput to something else? - "<input type='button' class='addticket' value='Add Parts'
-
onClick=\"addpartInput(\'"+dynamicInput+"\')\" >" +
right now for that line i am getting undetermined string literall
an its having a fit about addInput saying its not defined.
Thank you,
Rach
Yes, dynamicInput should be divIdName - the ID of the serial div.
Yes, dynamicInput should be divIdName - the ID of the serial div.
Hey Acoder,
I am still getting undetermined string literal. but i got no clue whats causeing it. -
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>" +
-
"<input type='button' class='addticket' value='Add Parts ""+count +""'
-
onClick=\"addpartInput(\'"+divIdName+"\')\">" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
Thank you,
Rach
Lines 8 and 9 should be one line.
PS. You don't need the extra escape characters (backslash) for the single quote.
Lines 8 and 9 should be one line.
PS. You don't need the extra escape characters (backslash) for the single quote.
Hey Acoder,
I couldn't get it all on one line but somehow i got it to work so i don't know what i did. But now its just not adding the parts right.
If i add parts under the first serial it does this
serial information 1
parts 2
parts 1
and if i add another serial an another part it does this
serial information 1
parts 2
parts 3
parts 2
serial information 2
and i cant remove any parts that are added right now what do i need to change
to var d = documnt.getElementById('partsInput'); to?
here is what i have for serial function
an here is what i have for the parts function - <!---PARTS--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById('dynamicInput');
-
<!---('partsInput')--->
-
-
<!---this works if only want to add a part under the serial you are working with, but if you have
-
serial information 1
-
and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts--->
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('thediv');
-
var partIdName = 'dynamic'+count+'Input';
-
<!---'parts'+count+'Input'--->
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
"<table class='createticketables' id='spaceup'>" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table class='createticketables' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields --->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
d.removeChild(olddiv);
-
}
-
-
</script>
an heres the html - <input type="hidden" value="0" id="theValue" />
-
<input type="hidden" value="0" id="aValue" />
-
<div id="dynamicInput">
-
-
</div>
-
<!--- All Ticket Information Appears Here--->
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
Thank you,
Rach
In addpartInput(), set parts to partName, not dynamicInput.
Also don't set partIdName to "dynamic"+count+"Input". Set it to something unique. I would suggest using partName as part of that, so partName+count or partName+"part"+count seem like good choices.
In addpartInput(), set parts to partName, not dynamicInput.
Also don't set partIdName to "dynamic"+count+"Input". Set it to something unique. I would suggest using partName as part of that, so partName+count or partName+"part"+count seem like good choices.
Hey Acoder,
I still can not get it to remove. An with the parts. For the first serial it is counting wrong but for the second serial its counting right. Here is an example
serial information 1
parts 2
parts 1
serial information 2
parts 3
parts 4
here is what i have for the parts function - <!---PARTS--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById('partName');
-
<!---('partsInput')--->
-
-
<!---this works if only want to add a part under the serial you are working with, but if you have
-
serial information 1
-
and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts--->
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('thediv');
-
var partIdName = 'part'+count+'Name';
-
<!---'parts'+count+'Input'--->
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
<!---what used originally for this tableclass='createticketables' id='spaceup'--->
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields --->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
d.removeChild(olddiv);
-
}
-
-
</script>
-
Thank you,
Rach
partName is already a string and I don't think a div with ID "partName" exists, so you'd want something like: - var parts = document.getElementById(partName);
On line 15, the element should be a div: - var partdiv = document.createElement('div');
When removing, you should be removing from the parent div so you can either pass in partName, or removeChild from oldDiv.parentNode.
Hey Acoder,
i am still running into the same trouble. An i am confused what you mean about the removing.
here is what i have for the parts function - <!---PARTS--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById(partName);
-
<!---('partsInput')--->
-
-
<!---this works if only want to add a part under the serial you are working with, but if you have
-
serial information 1
-
and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts--->
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'part'+count+'Name';
-
<!---'parts'+count+'Input'--->
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
<!---what used originally for this tableclass='createticketables' id='spaceup'--->
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields --->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
d.removeChild(olddiv);
-
}
-
-
</script>
Thank you,
Rach
Instead of d.removeChild(), you could try something like: - olddiv.parentNode.removedChild(olddiv);
Instead of d.removeChild(), you could try something like: - olddiv.parentNode.removedChild(olddiv);
Hey Acoder,
Ok i got the remove working. but its still number wrong for example if i have this when the page loads
serial 1 information
parts 1
an then i go to add another part it does this
serial 1 information
parts 2
parts 1
any suggestions?
here is what i have for parts. everything else is the same -
<!---PARTS--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById(partName);
-
<!---('partsInput')--->
-
-
<!---this works if only want to add a part under the serial you are working with, but if you have
-
serial information 1
-
and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts--->
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'part'+count+'Name';
-
<!---'parts'+count+'Input'--->
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
<!---what used originally for this tableclass='createticketables' id='spaceup'--->
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields --->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
olddiv.parentNode.removeChild(olddiv);
-
}
-
-
</script>
Thank you,
Rach
You say when you already have a part displayed when the page loads. Make sure it's inside the serial 1 div.
You say when you already have a part displayed when the page loads. Make sure it's inside the serial 1 div.
Hey Acoder,
Well reason it loads when the page loads is because of this. - <body onload="addInput('dynamicInput');addpartInput('dynamicInput');">
an i am not sure what you mean by already inside the serial 1 div are you meaning the main html div?
Thank you,
Rach
Change - addpartInput('dynamicInput');
to - addpartInput('dynamic1Input');
to insert inside the serial div.
Change - addpartInput('dynamicInput');
to - addpartInput('dynamic1Input');
to insert inside the serial div.
Hey Acoder,
I get the error that addpartInput is not defined. here is what it looks like now - <body onload="addInput('dynamicInput');addpartInput('dynamic1Input');">
Thank you,
Rach
Hmm. Anyway, I think that you should have this in the HTML directly rather than using JavaScript to create the initial ones. If you think this might be a problem because of redundancy, you could clone the divs.
Hey Acoder,
It was how you said to do it, not sure why it didn't work before but it worked. Do we still need to do this in the html directly? an if we don't is there anyway i could do something like this
serial information 1
parts 1 serial information 1
parts 2 serial information 1
serial information 2
parts 1 serial information 2
parts 2 serial information 2
the parts function - <!---PARTS--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById(partName);
-
<!---('partsInput')--->
-
-
<!---this works if only want to add a part under the serial you are working with, but if you have
-
serial information 1
-
and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts--->
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'part'+count+'Name';
-
<!---'parts'+count+'Input'--->
-
partdiv.setAttribute('id',partIdName);
-
<!---
-
Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
<!---what used originally for this tableclass='createticketables' id='spaceup'--->
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +"</th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields --->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
olddiv.parentNode.removeChild(olddiv);
-
}
-
-
</script>
and the html - <body onload="addInput('dynamicInput');addpartInput('dynamic1Input');">
-
-
<!--- Ticket Information --->
-
<input type="hidden" value="0" id="theValue" />
-
<input type="hidden" value="0" id="aValue" />
-
<div id="dynamicInput">
-
-
</div>
-
<!--- <div id="partsInput"> </div>--->
-
<!--- All Ticket Information Appears Here--->
-
-
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
Thank you,
Rach
If you put clear borders and spacing between each serial information, it shouldn't be a problem, but if it still is, just add "Serial Information" followed by the serial number which you can get from the div id (by parsing) or by passing in the number to addpartInput().
If you put clear borders and spacing between each serial information, it shouldn't be a problem, but if it still is, just add "Serial Information" followed by the serial number which you can get from the div id (by parsing) or by passing in the number to addpartInput().
Hey Acoder,
I tried spacing and border but still made me feel confused. How would i go about parsing to get the number for serial number. Also wanted to ask do you think for each part that goes under a different serial that it should start over
for example
serial information 1
parts 1
parts 2
serial information 2
parts 1
parts 2
instead of what it does now
serial information 1
parts 1
parts 2
serial information 2
parts 3
parts 4
been debating on if i need to do that or if the user would be fine with that so just wanted to ask your opinion.
Thank you,
Rach
It would be better to start over and that might actually be part of the problem.
We'll work on that first and see if that improves things. To start over, you'll need a count in each serial, so instead of using one single hidden input for parts count, create one in each serial in addInput(). Give each one a unique ID and access using document.getElementById() as you've been doing for other elements.
It would be better to start over and that might actually be part of the problem.
We'll work on that first and see if that improves things. To start over, you'll need a count in each serial, so instead of using one single hidden input for parts count, create one in each serial in addInput(). Give each one a unique ID and access using document.getElementById() as you've been doing for other elements.
Hey Acoder,
Ok so do i create a new element? an then do i access it in the parts function or in the serial function?
like this -
var newpart = document.createElement('div');
Thank you,
Rach
You could just add it to the partdiv.innerHTML string to make things easier.
You could just add it to the partdiv.innerHTML string to make things easier.
Hey Acoder,
so add the var newpart = document.createElement('div'); to the addInput and then
put document.getElementById() in the partdiv.innerHTML? Or do i create a hidden
field an the hidden field get the id?
Thank you,
Rach
Yes, a hidden field like the count field in the HTML (which is not required for parts). There's no need to create a div.
In addpartInput(), you'll need to access this hidden field to get the parts count, so you should also give it an ID.
Yes, a hidden field like the count field in the HTML (which is not required for parts). There's no need to create a div.
In addpartInput(), you'll need to access this hidden field to get the parts count, so you should also give it an ID.
Hey Acoder,
So instead of creating a div i need to create a input? like - var newpart = document.createElement('input');
-
an then create another different one in parts like - var apart = document.creatElement('input');
an then in the partsdiv.innerHTML do - <input type="hidden" value="0" id="newpart" />
-
<input type="hidden" value="0" id="apart" />
right? or am i confused.
Thank you,
Rach
No, you only need one count for each serial. This will replace the "aValue" hidden field in the HTML. So just copy that into the innerHTML string in addInput, but with a unique ID, e.g. "partscount"+count.
No, you only need one count for each serial. This will replace the "aValue" hidden field in the HTML. So just copy that into the innerHTML string in addInput, but with a unique ID, e.g. "partscount"+count.
Hey Acoder,
So would i copy all the fields that say avalue an make them just say something different like here is what avalue looks like - <script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById(partName);
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'part'+count+'Name';
-
partdiv.setAttribute('id',partIdName);
so just do this - <!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById(partName);
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'part'+count+'Name';
-
var partc = 'partscount'+count;
-
partdiv.setAttribute('id',partIdName);
-
i put this in the partdiv.innerHTML - <input type='hidden' value='0' id='partc' />
Thank you,
Rach
Instead of being in addpartInput, it needs to be in addInput, so you would need to set newdiv.innerHTML and the id/name needs to be set within the string similar to the buttons earlier in this thread. Then in addpartInput, instead of accessing "aValue", you would access the "partscount1", "partscount2", etc. depending on the serial to which the parts belong to.
Instead of being in addpartInput, it needs to be in addInput, so you would need to set newdiv.innerHTML and the id/name needs to be set within the string similar to the buttons earlier in this thread. Then in addpartInput, instead of accessing "aValue", you would access the "partscount1", "partscount2", etc. depending on the serial to which the parts belong to.
Hey Acoder,
Ok you completely lost me. Ok so this an this line needs to be in newdiv.innerHTML? an i am confused by the aValue part -
<input type='hidden' value='0' id='partc' />
Thank you,
Rach
Let's start again. I think you need to understand what's happening and what needs changing before attempting any changes to your code.
At the moment, you have one parts count. Having one parts count means that you have one count for all serials. To have separate part counts for each serial, you need to remove the "aValue" hidden field and create a new hidden field for parts counting for each serial. Then when adding parts, to get the count, you check this hidden field (the correct one depending on the serial under which this new part appears) rather than one single count as you currently have.
Do you understand all of this so far? If not, ask, otherwise we'll just end up going round in circles.
Let's start again. I think you need to understand what's happening and what needs changing before attempting any changes to your code.
At the moment, you have one parts count. Having one parts count means that you have one count for all serials. To have separate part counts for each serial, you need to remove the "aValue" hidden field and create a new hidden field for parts counting for each serial. Then when adding parts, to get the count, you check this hidden field (the correct one depending on the serial under which this new part appears) rather than one single count as you currently have.
Do you understand all of this so far? If not, ask, otherwise we'll just end up going round in circles.
Hey Acoder,
Ok that makes since to me. But i think there is 2 counts going on right now.
Because if i take out the avalue hidden field away from the code below then parts doesn't show up at all. I think you said in above post that i didn't need it anymore, but yet when i just took it out it won't bring up parts at all. Does it mean i am doing somthing wrong to aValue? - <!--- Ticket Information --->
-
<input type="hidden" value="0" id="theValue" />
-
<input type="hidden" value="0" id="aValue" />
-
<div id="dynamicInput">
-
-
</div>
-
<!--- <div id="partsInput"> </div>--->
-
<!--- All Ticket Information Appears Here--->
-
-
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
this is what i have for serial function
for parts function -
<!---PARTS--->
-
<script type="text/javascript">
-
<!---Adds multiple fields for parts --->
-
function addpartInput(partName){
-
var parts = document.getElementById(partName);
-
<!---('partsInput')--->
-
-
<!---this works if only want to add a part under the serial you are working with, but if you have
-
serial information 1
-
and serial information 2 an want to add information to serial information 1 you cant because parts always appear under the last serial information added if you click add parts--->
-
var getparts = document.getElementById('div');
-
var avalue = document.getElementById('aValue');
-
var count = (document.getElementById('aValue').value -1)+ 2;
-
avalue.value = count;
-
var partdiv = document.createElement('div');
-
var partIdName = 'part'+count+'Name';
-
<!---'parts'+count+'Input'--->
-
partdiv.setAttribute('id',partIdName);
-
-
<!--- Adds Extra fields for parts table --->
-
partdiv.innerHTML =
-
<!---what used originally for this tableclass='createticketables' id='spaceup'--->
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information <div id='dynamicInput'></div></th>" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name='hcpn_" + count + "' style='margin:0px'></td>" +
-
"<td class='red'>" +
-
"Parts been returned* " +
-
"<input type='checkbox' name='partsreturn_" + count +"' value='1'/>" +
-
"</td>" +
-
"<td>" +
-
"<td class='indent'>Defective<input type='checkbox' name='defective_" + count +"' value='1'/></td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>" +
-
"<table table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' >" +
-
"<tr>" +
-
"<td class='indent' id='formfieldpadding'>Follow up Date:(MM/DD/YYYY) " +
-
"<input type='text' name='followdate_" + count + "' value='' size='8'/> " +
-
"Current Date<input type='checkbox' name='followcheck_"+ count +"' value='' onClick='followdate.value=fill_date()'/></td>" +
-
"<td>On Site:</td>" +
-
"<td><select name='onsite_" + count +"'>" +
-
"<option value='No Choice' selected>No Choice</option>" +
-
"<option value='Yes'>Yes</option>" +
-
"<option value='No'>No</option>" +
-
"</select><td>" +
-
"<td># of Onsite:</td><td><select name='numonsite_" + count +"'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfloop from='0' to='10' index='nonsite'><cfoutput>" +
-
"<option value='#nonsite#'>#nonsite#</option></cfoutput></cfloop>" +
-
"</select><td>" +
-
"</tr>" +
-
"</table>" +
-
<!---"<input type='hidden' value='0' id='aValue' />" +--->
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
-
<!--- Adds Delete to every ticket --->
-
partdiv.innerHTML = partdiv.innerHTML +
-
"<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
-
"<tr>" +
-
"<td>" +
-
"<input type='button' class='removeticket' value='Remove Parts ""+count +""' onclick=\"removetheElement(\'"+partIdName+"\')\"></a>" +
-
"</td>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
document.getElementById(partName).appendChild(partdiv);
-
}
-
-
<!---Allows us to remove multiple fields--->
-
function removetheElement(divNum) {
-
var d = document.getElementById('partsInput');
-
var olddiv = document.getElementById(divNum);
-
olddiv.parentNode.removeChild(olddiv);
-
}
-
-
</script>
and all html that goes with it - <body onload="addInput('dynamicInput');addpartInput('dynamic1Input');">
-
<!--- Ticket Information --->
-
<input type="hidden" value="0" id="theValue" />
-
<input type="hidden" value="0" id="aValue" />
-
<div id="dynamicInput">
-
-
</div>
-
<!--- <div id="partsInput"> </div>--->
-
<!--- All Ticket Information Appears Here--->
-
-
-
<input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
Thank you,
Rach
The reason why parts won't show up is because the function needs to be changed to access the new hidden field. To do that, first add the hidden field to newdiv.innerHTML in addInput(). This will add a new parts count for each serial. Give it the ID partc (which you set on line 12). We'll deal with the rest once this part's right.
The reason why parts won't show up is because the function needs to be changed to access the new hidden field. To do that, first add the hidden field to newdiv.innerHTML in addInput(). This will add a new parts count for each serial. Give it the ID partc (which you set on line 12). We'll deal with the rest once this part's right.
Hey Acoder,
Ok added it right before the delete in the serial function - "</td>" +
-
"</tr>" +
-
"</table>" +
-
"<input type='hidden' value='0' id='partc' />" +
-
"<input type='hidden' name='serialcount' value='" + count + "'>";
-
-
<!--- Adds Delete to every ticket --->
whats next?
Thank you,
Rach
Sign in to post your reply or Sign up for a free account.
Similar topics
by: PA |
last post by:
Can anyone tell me how to write XDR schema for XML below:
<?xml version="1.0"?>
<bk:Book xmlns:bk="urn:BookSchema.xdr">
<a:title>Sam's...
|
by: Elf M. Sternberg |
last post by:
This is driving me nuts. I don't want to have to do hokey Javascript
magic to make it go away, so please, help me. I have a form with two
SUBMIT...
|
by: sql-db2-dba |
last post by:
There are 2 tables A and B with A being the parent of B.
Table A
(
Col1 varchar(5) Not Null
)
Table B
(
B_PK varchar(5) Not Null ,
|
by: Rich Kucera |
last post by:
Holding all versions at 5.0.4, Multiple stacks with multiple-version
configurations inevitable
Will have to wait to see what the impact of...
|
by: |
last post by:
I'm seeking (probably basic) guidance on the right way to split a large site
that's supposed to represent one domain(mydomain.org) into many small...
|
by: Jankie |
last post by:
Hi all !
I hope someone help me with problem that I assume common,yet googling didnt even mention it.
In brief:
User uploads multiple files at one...
|
by: bonneylake |
last post by:
Hey Everyone,
Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple...
|
by: DragonLord |
last post by:
Ok here is the situation in detail.
Single form with multiple items on it, 4 of which are panls that contain radio butons. Each panel loads it's...
|
by: Lyn DeMaio |
last post by:
I've been tasked with taking two unrealted tables (Providers and Patients, no common field) and allow users, on one form (or form/subform) to search...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the...
| |