Hey Everyone,
What i am trying to do is show previously entered information. I know i need a loop for this , but i am not sure how to loop through this based on my form appears all in the javascript
here is my code - <cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,resolution,resolution_date,
-
verification_date,rma_data,type_hardware_failure,dept_responsibility,resolution_verified_by FROM dbo.tbl_CS_serial
-
</cfquery>
-
-
<cfoutput query="serial">
-
<cfset model_no = #model_no#>
-
<cfset product_type = #product_type#>
-
<cfset type_hardware_failure = #type_hardware_failure#>
-
<cfset software_hardware = #software_hardware#>
-
<cfset resolution_verified_by = #resolution_verified_by#>
-
<cfset dept_responsibility = #dept_responsibility#>
-
</cfoutput>
-
-
<script type="text/javascript">
-
-
<!---Allows us to show previous fields --->
-
-
function showInput(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#'<cfif #model# is #evaluate(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>";
-
-
<!--- Adds Extra fields for Serial Number and Software/Hardware --->
-
newdiv.innerHTML = newdiv.innerHTML +
-
"<table class='zpExpandedTable' id='modeltable'>" +
-
"<tr>" +
-
"<td id='paddingformultitop'>" +
-
"Serial Number: " +
-
"<cfoutput query="serial"><input type='text' name='serialnum_" + count + "' value='#pka_serialNo#' ></cfoutput>" +
-
" Software/Hardware: " +
-
"<select name='softhardware_" + count + "'>" +
-
"<option value='' selected>No Choice</option>" +
-
"<cfoutput query='getSoftHard'>" +
-
"<option value='#pk_softwareHardware#'<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#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 500 characters. )"+
-
"<br>" +
-
"<cfoutput query="description"><textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'>#description#</textarea></cfoutput>" +
-
"</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 500 characters. )"+
-
"<br>" +
-
"<cfoutput query='serial'><textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'>#resolution#</textarea></cfoutput>" +
-
"</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>" +
-
"<cfoutput query='serial'><input type='text' name='resdate_" + count + "' value='#resolution_date#'> </cfoutput>" +
-
-
" 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#'<cfif "#fname# #lname#" is #resolution_verified_by#>selected</cfif>>#fname# #lname#</option>" +
-
" </cfoutput>" +
-
"</select>" +
-
"</td>" +
-
"</tr>" +
-
"</table>";
-
-
-
<!--- Adds Extra fields for Vertification Date, Current Date (for vertification date) --->
-
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'>" +
-
"<cfoutput query='serial'><input type='text' name='vertifidate_" + count + "' value='#verification_date#'> </cfoutput>" +
-
" 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#'<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#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 500 characters. )"+
-
"<br/>" +
-
"<cfoutput query='serial'><textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='rma_" + count + "' >#rma_data#</textarea></cfoutput> " +
-
"</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><br>";
-
-
document.getElementById(divName).appendChild(newdiv);
-
-
}
-
</script>
i was using this after i submitted my form to loop through it. it was used to submit the form fields and also show a print screen on what was previously entered. - <CFSET machineListLen = listLen(Form.serialcount)>
-
<CFLOOP from="1" to="#machineListLen#" index="machineCount">
-
<CFSET serialnum = "Form.serialnum_" & machineCount>
-
<CFSET modelno = "Form.modelno_" & machineCount>
-
<CFSET producttype = "Form.producttype_" & machineCount>
-
<CFSET softhardware = "Form.softhardware_" & machineCount>
-
<CFSET resolution = "Form.resolution_" & machineCount>
-
<CFSET resdate = "Form.resdate_" & machineCount>
-
<CFSET resvertified = "Form.resvertified_" & machineCount>
-
<CFSET vertifidate = "Form.vertifidate_" & machineCount>
-
<CFSET deptvendor = "Form.deptvendor_" & machinecount>
-
<CFSET hardwarefailure = "Form.hardwarefailure_" & machineCount>
-
<CFSET rma = "Form.rma_" & machineCount>
-
<CFSET thedescription = "Form.thedescription_" & machineCount>
-
-
#evaluate(modelno)#....an so on.
but i am not sure if i can combine the above with what i have now because i am showing previously entered data an not entering the data.
Thank you for all the help,
Rach
Sep 22 '08
60 5189
It seems as though this line shows the description (line 83): - <cfloop query="description"><textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#">#description#</textarea></cfloop>
Is the problem that instead of one description per serial, it's showing all descriptions side by side or is it that multiple descriptions can appear under one serial, but they're just not in the right place?
Hey Acoder,
Yes its showing them but its putting them side by side. It shows multiple descriptions. like for example
serial information 1
description 1 description 2
serial information 2
description 1 description 2
when it needs to be like
serial information 1
description 1
serial information 2
description 2
Thank you,
Rach
Is description not a field in the serial table? Why have you got a separate query for description?
Is description not a field in the serial table? Why have you got a separate query for description?
Hey Acoder,
No the description is not in the serial table its in the description table. An i had forgotten about that till i looked at it yesterday when i added 2 descriptions.
Thank you,
Rach
Is it one description per serial or could you have more than one per serial? What kind of query are you using to retrieve the descriptions?
Is it one description per serial or could you have more than one per serial? What kind of query are you using to retrieve the descriptions?
Hey Acoder,
Its definitely one description per serial. an this is what i am using to retrieve the description - <!---Shows what was previously entered into description table--->
-
<cfquery name="description" datasource="CustomerSupport">
-
SELECT fk_serialNo,fk_ticketNo,description
-
FROM dbo.tbl_CS_notes_descr
-
WHERE fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
Thank you,
Rach
If it's always only one, why not store in the serial table? If that's not an option, make a join query when getting the serial, so the description is also included and you don't need two separate queries.
If it's always only one, why not store in the serial table? If that's not an option, make a join query when getting the serial, so the description is also included and you don't need two separate queries.
Hey Acoder,
That is a brillant idea (why didn't i think of that!). An well i tried it but i am having a weird problem.
This is what its doing
serial number: 963
description: this is the description
serial number: 999
description: this is the description
serial number: 963
description: this is the second description
serial number: 999
description: this is the second description
an it needs to be
serial number: 963
description: this is the description
serial number: 999
description: this is the second description
here is what i have for the cfquery. it has the serial an description in it now. - <cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
-
resolution,resolution_date,verification_date,rma_data,type_hardware_failure,
-
dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
-
FROM dbo.tbl_CS_serial, dbo.tbl_CS_notes_descr
-
WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
that an inbetween the div i had this, i took the cfloop off from around description. - <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
-
<tr>
-
<td id="paddingformutli">
-
Description:
-
</td>
-
<td class="descriptionmoveinmulti">
-
( You may enter up to 500 characters. )
-
<br>
-
<cfloop query="description"><textarea maxlength="500" onkeyup="return ismaxlength(this)" onkeydown="return ismaxlength(this)" rows="4" cols="60" name="thedescription_#count#">#description#</textarea></cfloop>
-
</td>
-
</tr>
-
</table>
but besides that everything else is the same so i am not sure why its putting the results twice. Any ideas?
Thank you,
Rach
That's because you've joined the query without removing the duplicates by matching up the IDs. See left join.
That's because you've joined the query without removing the duplicates by matching up the IDs. See left join.
Hey Acoder,
I read it but i think i got something confused.do i need to do to each field dbo.tbl_CS_serial.pka_serialNo? - <cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
-
resolution,resolution_date,verification_date,rma_data,type_hardware_failure,
-
dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
-
FROM dbo.tbl_CS_serial
-
LEFT JOIN dbo.tbl_CS_notes_descr
-
ON pkb_fk_ticketNo=fk_ticketNo
-
WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
-
</cfquery>
Thank you,
Rach
Hey Acoder,
I figured out what i did wrong. Here is what the results where. - <!---Shows what was previously entered into serial and description table--->
-
<cfquery name="serial" datasource="CustomerSupport">
-
SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
-
resolution,resolution_date,verification_date,rma_data,type_hardware_failure,
-
dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
-
FROM dbo.tbl_CS_serial
-
LEFT JOIN dbo.tbl_CS_notes_descr
-
ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
-
dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
-
WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
-
ORDER BY pkb_fk_ticketNo
-
</cfquery>
Thank you again for all the help!!! :)
Rach
Good work, though I'm not sure about the where clause. I think one of them is probably not needed.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Charles Alexander |
last post by:
Hello
I am new to php & MySQL - I am trying to retrieve some records from a MySQL
table and redisplay them. The data in list form looks like this:
Sample_ID Marker_ID Variation
...
|
by: Ravi |
last post by:
Hi All,
I am trying to execute a select statement using the DBI module
of perl in a for loop. I am getting a strange behaviour, the select
statement is excuting correctly only for the last element...
|
by: Gremlin |
last post by:
If you are not familiar with the halting problem, I will not go into
it in detail but it states that it is impossible to write a program
that can tell if a loop is infinite or not. This is a...
|
by: Roman Töngi |
last post by:
for (int i = 1; i <= 10; i++)
cout << i << endl;
I expected the following:
1
2
3
4
5
6
|
by: Alex |
last post by:
Compiler - Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland
Linker - Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland
Platform - Win32 (XP)
Quite by accident I stumbled...
|
by: Aaron Ackerman |
last post by:
What is the sytax for exiting a for loop in C#?
|
by: John Pass |
last post by:
What is the difference between a While and Do While/Loop repetition structure.
If they is no difference (as it seems) why do both exist?
|
by: Claudio Grondi |
last post by:
Sometimes it is known in advance, that the time spent in a loop will be
in order of minutes or even hours, so it makes sense to optimize each
element in the loop to make it run faster.
One of...
|
by: ADezii |
last post by:
If you are executing a code segment for a fixed number of iterations, always use a For...Next Loop instead of a Do...Loop, since it is significantly faster. Each pass through a Do...Loop that...
|
by: numlock00 |
last post by:
I have a nested 'while' loop that won't repeat, no matter how many times the outer loop repeats. The outer loop reads through an array of elements; the inner loop Ithe 'while' loop) is supposed to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |