ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 20th, 2012, 09:04 AM
mevasquez mevasquez is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 14 mevasquez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 11 sec
Reputation Power: 0
Sumbit output of form with multiple records (Help)

I have looked far and wide without success for the answer.
I have a form that outputs devices to the end user. There is a checkbox that the user can click. Sometimes there are two checkboxes. The form is used to display the Telecom devices a user possesses that our telecom department shows that these devices are assigned to the end user. If the end user has turned in those devices and the devices still shows the end user still has possession. The end user can check the checkbox(s) and an email will be generated to tell Telecom that he/she has already turned in the items.

My form is as follows:
Code:
<form action="#CGI.SCRIPT_NAME#?v=#v#" method="post" >
<table">
<tr>
<th>Device Type</th>
<th>Number</th>
<th>Model</th>
<th>Serial Num</th>
<th>Date Assigned</th>
<th>Agreement Form</th>
<th>View</th>
<th>Not Assigned</th>
/tr>
<input type="hidden" id="publicFunc" name="publicFunc" value="ToTelecom" />
<cfloop query="myDevices">
<input type="hidden" name="DeviceType" value="#mydevices.deviceName#" /> 
<input type="hidden" name="phoneNumber" value="#mydevices.phonenumber#" /> 
<input type="hidden" name="modelNumber" value="#mydevices.modelName#" /> 
<input type="hidden" name="SerialNumber" value="#mydevices.serialNum#" />
<input type="hidden" name="dateAssigned" value="#dateformat(myDevices.IssueDate, 'mm/dd/yyyy')#" /> 
<tr>
<td style="text-align:left;">#mydevices.deviceName#</td>
<td>#phone#</td>
<td>#mydevices.modelName#</td>
<td>#mydevices.serialNum#</td>
<td>#dateformat(myDevices.IssueDate, 'mm/dd/yyyy')#</td>
<td><input type="checkbox" id="notAssigned[]" value="#mydevices.deviceName#" name="notAssigned" /></td>
</tr>

</cfloop>
<tr>
<td><input type="submit" value="Submit to Telecom"  name="Submit"  /></td>
</tr>
</table


On the action page, I want to email the information that the end user checked on the checkbox. I have it working for one checkbox but if a user checks both boxes the output comes out like this.
<cfdump var="#form#">
DATEASSIGNED 07/06/2011,04/06/2011
DEVICETYPE Air Card,Blackberry
FIELDNAMES PUBLICFUNC,DEVICETYPE,PHONENUMBER,MODELNUMBER,SERIALNUMBER,DATEASSIGNED,NOTASSIGNED,SUBMIT
MODELNUMBER Sierra 250U,Blackberry Bold
NOTASSIGNED Air Card,Blackberry
PHONENUMBER 6198462907,6198226032
PUBLICFUNC ToTelecom
SERIALNUMBER 09613997780 ,268435459706096635
SUBMIT Submit to Telecom

If you noticed, such as the modelnumber it shows two items, a Sierra 250U and a Blackberry separated by a coma.

How do I separate all the fields to output as
Fieldname names
#DeviceType# #Modelnumber# #phonenumber# etc.
#DeviceType# #Modelnumber# #phonenumber# etc.

How do I split each variable into two separate items?

TIA
Mike

Reply With Quote
  #2  
Old March 20th, 2012, 10:09 AM
mevasquez mevasquez is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 14 mevasquez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 11 sec
Reputation Power: 0
I figured it out. You have to used the ListToArray function and then use another cfloop to output the format in a readable manner. Here is the example

<CFLOOP index="LoopCount" from="1" to="#ListLen(form.devicetype)#">
<cfset aDeviceType = #ListToArray(form.DeviceType, ",")#>
<cfset aModelNumber = #ListToArray(form.ModelNumber, ",")#>
<cfset aPhoneNumber = #ListToArray(Form.PhoneNumber, ",")#>
<cfset aSerialNumber = #ListToArray(Form.SerialNumber, ",")#>
<cfset aDateAssigned = #ListToArray(Form.DateAssigned, ",")#>
</CFLOOP>

<cfloop index="x" from="1" to="#ListLen(form.devicetype)#">
#aDeviceType[x]# #aModelNumber[x]# #aPhoneNumber[x]# #aSerialNumber[x]# #aDateAssigned[x]#<br />
</cfloop>

Mike

Quote:
Originally Posted by mevasquez
I have looked far and wide without success for the answer.
I have a form that outputs devices to the end user. There is a checkbox that the user can click. Sometimes there are two checkboxes. The form is used to display the Telecom devices a user possesses that our telecom department shows that these devices are assigned to the end user. If the end user has turned in those devices and the devices still shows the end user still has possession. The end user can check the checkbox(s) and an email will be generated to tell Telecom that he/she has already turned in the items.

My form is as follows:
Code:
<form action="#CGI.SCRIPT_NAME#?v=#v#" method="post" >
<table">
<tr>
<th>Device Type</th>
<th>Number</th>
<th>Model</th>
<th>Serial Num</th>
<th>Date Assigned</th>
<th>Agreement Form</th>
<th>View</th>
<th>Not Assigned</th>
/tr>
<input type="hidden" id="publicFunc" name="publicFunc" value="ToTelecom" />
<cfloop query="myDevices">
<input type="hidden" name="DeviceType" value="#mydevices.deviceName#" /> 
<input type="hidden" name="phoneNumber" value="#mydevices.phonenumber#" /> 
<input type="hidden" name="modelNumber" value="#mydevices.modelName#" /> 
<input type="hidden" name="SerialNumber" value="#mydevices.serialNum#" />
<input type="hidden" name="dateAssigned" value="#dateformat(myDevices.IssueDate, 'mm/dd/yyyy')#" /> 
<tr>
<td style="text-align:left;">#mydevices.deviceName#</td>
<td>#phone#</td>
<td>#mydevices.modelName#</td>
<td>#mydevices.serialNum#</td>
<td>#dateformat(myDevices.IssueDate, 'mm/dd/yyyy')#</td>
<td><input type="checkbox" id="notAssigned[]" value="#mydevices.deviceName#" name="notAssigned" /></td>
</tr>

</cfloop>
<tr>
<td><input type="submit" value="Submit to Telecom"  name="Submit"  /></td>
</tr>
</table


On the action page, I want to email the information that the end user checked on the checkbox. I have it working for one checkbox but if a user checks both boxes the output comes out like this.
<cfdump var="#form#">
DATEASSIGNED 07/06/2011,04/06/2011
DEVICETYPE Air Card,Blackberry
FIELDNAMES PUBLICFUNC,DEVICETYPE,PHONENUMBER,MODELNUMBER,SERIALNUMBER,DATEASSIGNED,NOTASSIGNED,SUBMIT
MODELNUMBER Sierra 250U,Blackberry Bold
NOTASSIGNED Air Card,Blackberry
PHONENUMBER 6198462907,6198226032
PUBLICFUNC ToTelecom
SERIALNUMBER 09613997780 ,268435459706096635
SUBMIT Submit to Telecom

If you noticed, such as the modelnumber it shows two items, a Sierra 250U and a Blackberry separated by a coma.

How do I separate all the fields to output as
Fieldname names
#DeviceType# #Modelnumber# #phonenumber# etc.
#DeviceType# #Modelnumber# #phonenumber# etc.

How do I split each variable into two separate items?

TIA
Mike

Reply With Quote
  #3  
Old March 20th, 2012, 10:10 AM
mevasquez mevasquez is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 14 mevasquez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 20 m 11 sec
Reputation Power: 0
Sumbit output of form with multiple records (Help)

I figured it out. You have to used the ListToArray function and then use another cfloop to output the format in a readable manner. Here is the example

<CFLOOP index="LoopCount" from="1" to="#ListLen(form.devicetype)#">
<cfset aDeviceType = #ListToArray(form.DeviceType, ",")#>
<cfset aModelNumber = #ListToArray(form.ModelNumber, ",")#>
<cfset aPhoneNumber = #ListToArray(Form.PhoneNumber, ",")#>
<cfset aSerialNumber = #ListToArray(Form.SerialNumber, ",")#>
<cfset aDateAssigned = #ListToArray(Form.DateAssigned, ",")#>
</CFLOOP>

<cfloop index="x" from="1" to="#ListLen(form.devicetype)#">
#aDeviceType[x]# #aModelNumber[x]# #aPhoneNumber[x]# #aSerialNumber[x]# #aDateAssigned[x]#<br />
</cfloop>

Mike

Quote:
Originally Posted by mevasquez
I have looked far and wide without success for the answer.
I have a form that outputs devices to the end user. There is a checkbox that the user can click. Sometimes there are two checkboxes. The form is used to display the Telecom devices a user possesses that our telecom department shows that these devices are assigned to the end user. If the end user has turned in those devices and the devices still shows the end user still has possession. The end user can check the checkbox(s) and an email will be generated to tell Telecom that he/she has already turned in the items.

My form is as follows:
Code:
<form action="#CGI.SCRIPT_NAME#?v=#v#" method="post" >
<table">
<tr>
<th>Device Type</th>
<th>Number</th>
<th>Model</th>
<th>Serial Num</th>
<th>Date Assigned</th>
<th>Agreement Form</th>
<th>View</th>
<th>Not Assigned</th>
/tr>
<input type="hidden" id="publicFunc" name="publicFunc" value="ToTelecom" />
<cfloop query="myDevices">
<input type="hidden" name="DeviceType" value="#mydevices.deviceName#" /> 
<input type="hidden" name="phoneNumber" value="#mydevices.phonenumber#" /> 
<input type="hidden" name="modelNumber" value="#mydevices.modelName#" /> 
<input type="hidden" name="SerialNumber" value="#mydevices.serialNum#" />
<input type="hidden" name="dateAssigned" value="#dateformat(myDevices.IssueDate, 'mm/dd/yyyy')#" /> 
<tr>
<td style="text-align:left;">#mydevices.deviceName#</td>
<td>#phone#</td>
<td>#mydevices.modelName#</td>
<td>#mydevices.serialNum#</td>
<td>#dateformat(myDevices.IssueDate, 'mm/dd/yyyy')#</td>
<td><input type="checkbox" id="notAssigned[]" value="#mydevices.deviceName#" name="notAssigned" /></td>
</tr>

</cfloop>
<tr>
<td><input type="submit" value="Submit to Telecom"  name="Submit"  /></td>
</tr>
</table


On the action page, I want to email the information that the end user checked on the checkbox. I have it working for one checkbox but if a user checks both boxes the output comes out like this.
<cfdump var="#form#">
DATEASSIGNED 07/06/2011,04/06/2011
DEVICETYPE Air Card,Blackberry
FIELDNAMES PUBLICFUNC,DEVICETYPE,PHONENUMBER,MODELNUMBER,SERIALNUMBER,DATEASSIGNED,NOTASSIGNED,SUBMIT
MODELNUMBER Sierra 250U,Blackberry Bold
NOTASSIGNED Air Card,Blackberry
PHONENUMBER 6198462907,6198226032
PUBLICFUNC ToTelecom
SERIALNUMBER 09613997780 ,268435459706096635
SUBMIT Submit to Telecom

If you noticed, such as the modelnumber it shows two items, a Sierra 250U and a Blackberry separated by a coma.

How do I separate all the fields to output as
Fieldname names
#DeviceType# #Modelnumber# #phonenumber# etc.
#DeviceType# #Modelnumber# #phonenumber# etc.

How do I split each variable into two separate items?

TIA
Mike

Reply With Quote
  #4  
Old March 20th, 2012, 10:11 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
If you can guarantee that the order they display is always the same as the order they'll be processed on the server, you can just split the list using the list functions.

The better way would be to differentiate the form field names so you can tell which ones go with which device. You can do this by appending the device ID, something like:

<input type="checkbox" id="notAssigned[]" value="#mydevices.deviceName#" name="notAssigned_#myDevices.deviceId#" />

(or whatever your device ID column name is).

I wrote a CFC that will do this pretty well but I haven't updated it in a while so use at your own risk. That said I think it should work for you. http://formutils.riaforge.org/

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Sumbit output of form with multiple records (Help)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap