CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Many-to-Many Checkbox List in Upload Form: Closer, But Still No Cigar

Print topic Send  topic

Author Message
maggiemel

Posts: 75
Posted: 04/07/2005, 1:35 PM

Haven't received any response for my two outstanding issues, so I thought I'd consolidate them here in one post.

Issue #1 is my upload form. I use the "Before Process File" event to change the location of the upload directory based upon a radio button choice on my form. It works well for the upload, but successive visits to the record form act as if there's no file (because the form is looking for it in the default location) and, for the same reason, the file is not deleted when I delete the record from the database.

Issue #2 is my checkbox list. Apparently, when you have a checkbox list on the same form with an upload component (at least, the Persits upload component) you can no longer use Request.Form method for gathering your form items. I figured out that I could substitute objUpload.Form for Request.Form, but when applying this to the Many-to-Many Checkbox List example, only the first checked value gets added to the table in the database.

Maybe I'm approaching all of this the wrong way. If so, perhaps someone can shed some light on a better way. The application is a document respository being shared among several offices. The idea is to let folks (a) upload a document, (b) decide whether it should go into the default directory or an alternate directory, and (c) let them tick checkboxes to indicate which offices the document is applicable to.

Any assistance is greatly appreciated.

Many thanks in advance.
_________________
Melissa Cahill
http://www.hellcatmaggie.net/
View profile  Send private message
ryan

Posts: 41
Posted: 04/07/2005, 5:45 PM

Melissa :

I have a hard time visualizing ur application but I consistently do this for my web projects. I only upload 1 time (1 input field) then the list are grouped by checkboxes so I can delete them afterwards (the record and the physical file that resides on the server).

'-------------------------------------------------------------------------------------------
<!-- BEGIN Grid m_CSVfile1 --><font class="GiantStepsFormHeaderFont"></font>
<form action="d_GenerateReport.asp" method="post">
<table class="GiantStepsFormTABLE" cellspacing="0" cellpadding="3">
<tr>
<td class="GiantStepsColumnTD" nowrap> </td>
<td class="GiantStepsColumnTD" nowrap>File ID </td>
<td class="GiantStepsColumnTD" nowrap>The file </td>
<td class="GiantStepsColumnTD" nowrap>Date Time
Generated</td>
</tr>

<!-- BEGIN Row -->
<tr>
<td class="GiantStepsDataTD"><input type="checkbox" name="DfID" value="{fID}"> </td>
<td class="GiantStepsDataTD"><input type="hidden" name="{fID_Name}" value="{fID}">{count_} </td>
<td class="GiantStepsDataTD"><a class="arial_y_b8" target="_blank" href="../csv/{thefile}.csv">{thefile}</a> </td>
<td class="GiantStepsDataTD">{GeneratedDateTime}</td>
</tr>
<!-- END Row -->
<!-- BEGIN NoRecords -->
<tr>
<td class="GiantStepsDataTD" colspan="4">No
records </td>
</tr>
<!-- END NoRecords -->
<tr>
<td class="GiantStepsFooterTD" nowrap align="center" colspan="4"><input type="submit" value="Delete" name="Delete" class="GiantstepsButton"> 
<!-- BEGIN Navigator Navigator -->
<!-- BEGIN First_On --><a class="GiantStepsNavigatorLink" href="{First_URL}"><img src="Themes/GiantSteps/FirstOn.gif" border="0"></a> <!-- END First_On -->
<!-- BEGIN Prev_On --><a class="GiantStepsNavigatorLink" href="{Prev_URL}"><img src="Themes/GiantSteps/PrevOn.gif" border="0"></a> <!-- END Prev_On --> 
<!-- BEGIN Pages -->
<!-- BEGIN Page_On --><a class="GiantStepsNavigatorLink" href="{Page_URL}">{Page_Number}</a> <!-- END Page_On -->
<!-- BEGIN Page_Off -->{Page_Number} <!-- END Page_Off --><!-- END Pages -->of
{Total_Pages} 
<!-- BEGIN Next_On --><a class="GiantStepsNavigatorLink" href="{Next_URL}"><img src="Themes/GiantSteps/NextOn.gif" border="0"></a> <!-- END Next_On -->
<!-- BEGIN Last_On --><a class="GiantStepsNavigatorLink" href="{Last_URL}"><img src="Themes/GiantSteps/LastOn.gif" border="0"></a> <!-- END Last_On --><!-- END Navigator Navigator -->  </td>
</tr>

</table>
<!-- END Grid m_CSVfile1 -->
</form>
'-------------------------------------------------------------------------------------------

Then my d_GenerateReport's (action page) Before Show Event is
BTW JRedirect is Response.Redirect :)
'-------------------------------------------------------------------------------------------
Function m_ldummy_admleft_BeforeShow() 'm_ldummy_admleft_BeforeShow @3-92080924

'Custom Code @4-73254650
' -------------------------
' Write your own code here.
dim cbox,cboxarr,ii,SQL,do_,whatcat,tw
whatcat="Done"
cbox = CCGetParam("DfID",Empty)
'Response.Write(cbox) : Response.End
IF (cbox="") THEN JRedirect("a_GenerateReport.asp?whatcat=2") 'JRedirect("a_Consolidated.asp") 'JRedirect("a_Consolidated.asp?PL="&tw)
cboxarr = Split(cbox,",")
FOR ii = 0 TO UBound(cboxarr)
'this deletes the physical file from theserver
do_ = DelFileCSV(cboxarr(ii))
SQL = "DELETE FROM m_CSVfile " & _
"WHERE (fID="&CCToSQL(cboxarr(ii),"Text")&")"
DBConnection1.Execute(SQL)
NEXT
'do_ = JRedirect("a_Consolidated.asp?PL="&tw)
do_ = JRedirect("a_GenerateReport.asp?whatcat=2") 'JRedirect("a_Consolidated.asp")
' -------------------------
'End Custom Code

End Function 'Close m_ldummy_admleft_BeforeShow @3-54C34B28

Function DelFileCSV(bygenID)
Dim myFSO,thefile,InventoryPathFile,Connection
'--Set Connection = New clsDBConnection1 : Connection.Open
SET myFSO = Server.CreateObject("Scripting.FileSystemObject")
thefile = CCDLookup("thefile","m_CSVfile","fID="&CCToSQL(bygenID,"Text"),DBConnection1)
'--Connection.Close : Set Connection = Nothing
InventoryPathFile = PathDump1()&thefile&".csv"
'Response.Write(InventoryPathFile):Response.End
IF myFSO.FileExists(InventoryPathFile) Then
myFSO.DeleteFile(InventoryPathFile)
END IF
SET myFSO = NOTHING
End Function

'-------------------------------------------------------------------------------------------

_________________
(\__/)
(='.'=)
(")_(")
View profile  Send private message
maggiemel

Posts: 75
Posted: 04/08/2005, 6:38 AM

Ryan, I appreciate your attempt to help me here, but I think we're doing two different things.

The checkboxes on my upload (record) form do not have anything to do with whether or not to remove the document. Rather, they comprise a list of offices. The document which is being uploaded may be useful to people in one or several of six offices. So the idea is to let the user upload a document, then check off which offices should see the document in their listing.

The problem has to do with the Persits Upload Component. I even found mention of it in their support pages here: http://support.persits.com/show.asp?code=PS01032617

When using their upload component in my form where there is also a multi select option (or a multi checkbox list in my case), you can't use the Request.Form convention to iterate through your form fields (as is indicated in the "Many to Many Checkbox List" example. You need to use Upload.Form. But I encounter a problem using Upload.Form to iterate through the form fields in that it only seems to grab the first value of the checkbox list. So if the user checks "New York," "Los Angeles" and "London," only "New York" gets entered into the database.

The support page on Persits site says I can use some "If ... Then" logic to make my form work the way I want to, but when I try this I get server errors. So, I'm hoping somebody out there, somewhere, has encountered this and has the correct syntax (or magic) to make this work.

Ever hopeful,
Melissa

_________________
Melissa Cahill
http://www.hellcatmaggie.net/
View profile  Send private message
Terry
Posted: 07/09/2005, 3:11 PM

Melissa, did you ever get this to work?
wkempees


Posts: 1679
Posted: 07/10/2005, 3:09 PM

Melissa,

Not using ASP, knowing FileUpload differs from the PhP approach.
I do seem to understand the goal you're after.
Why not keep your checkbox filled form with all the other user oriented prompts and fields, but put the physical upload of the file in a separate form, either before reaching your decision form or triggered by a custom UPLOAD A FILE button?

That way the problems I read in your post do not persist.
greetz,
Walter

For the sake of discussion, this is why we upload files into BLOBS.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/10/2005, 3:09 PM

Melissa,

Not using ASP, knowing FileUpload differs from the PhP approach.
I do seem to understand the goal you're after.
Why not keep your checkbox filled form with all the other user oriented prompts and fields, but put the physical upload of the file in a separate form, either before reaching your decision form or triggered by a custom UPLOAD A FILE button?

That way the problems I read in your post do not persist.
greetz,
Walter

For the sake of discussion, this is why we upload files into BLOBS.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/10/2005, 3:10 PM

sorry for the double submit, clicking the button twice, no means of editing or deleting your own posts.
8-)
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
Terry
Posted: 07/10/2005, 8:48 PM

I'm struggling through this same problem. I've already thought of using your suggestion, but it frustrates me that I can't get this to work. The ASPupload technical people have assured me that it's supposed to work as documented - multiple checkboxes create an array of items with the same control name and I should be able to iterate through them to retrieve the checked values.

However, this isn't happening and I suspect its because of how the CCS classes wrap the ASPupload object and how the object's properties are exposed.

Would love to hear from anyone from YES... I'm still waiting on a response from tech support.
maggiemel

Posts: 75
Posted: 07/11/2005, 6:50 AM

Yes, I did get this to work in a slightly modified fashion. I am not using checkbox list now but rather listbox which allows multiple choices. It took a little assistance from the YES support people, but in fact it DOES work as outlined in the Many-to-Many Listbox example. You must substitute "objUpload.Form" instead of "Request.Form" in the statement where you split the array (this applies to Persits Upload and ASP/VB upload components).

As for the issue regarding dynamically changing the location of upload folder, Nicole helped me sort that out. Here is the link to that thread. Hope you will find it useful: http://forums.codecharge.com/posts.php?post_id=58536&s_...d+file+location

Best of luck!
_________________
Melissa Cahill
http://www.hellcatmaggie.net/
View profile  Send private message
Terry
Posted: 07/19/2005, 1:48 PM

Finally a solution to the problem of retrieving multiple values from a checkboxlist when using the ASPUpload component.

I figured out the problem was the way the CCS classes wrap the ASPUpload component. I then worked with tech support and they rewrote my suggestion into the standardized CCS format. So what you need to do is replace the following property in the clsFormElement class in classes.asp:

Public Property Let Name(ParameterName)
If mvarUploadObject is Nothing Then Exit Property
Dim Item
mvarValue=Empty
For Each Item in mvarUploadObject.Form
If LCase(Item.Name) = LCase(ParameterName) Then
If Not IsEmpty(mvarValue) Then _
mvarValue = mvarValue & ", "
mvarValue = mvarValue & CStr(Item.Value)
End If
Next
mvarCount = IIf(IsEmpty(mvarValue), 0, 1)
mvarName = ParameterName
End Property

Cheers,

Terry

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.