Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Side-by-Side List Dialog and database update

Status
Not open for further replies.

goodmama

Programmer
Sep 27, 2000
5
CA
Hi.
I need to implement a side-by-side list dialog in Cold Fusion as follows: I have two lists, side by side, one containing products I've chosen and one containing all available products. There are two buttons between the lists, to add/remove items from the 'chosen' list. Once the form is submitted, my old product choices in the database are deleted and the new set of chosen products are inserted.
I've got the database designed and populated. I've built the CF queries to select the 'chosen' products as well as the full product list. I've been able to display the 'chosen' list using the CFSELECT tag with MULTIPLE=YES.
I need help with building a Cold Fusion custom tag that implements the side-by-side dialog metaphor and then does the update of the database after the submit. I will eventually have 6 of these side-by-side lists on each of three different forms, with different list contents.
Any assistance would be appreciated.
Regards,
Marsh.
[sig][/sig]
 
Hi Marsh,

I quite don't understand "side by side dialog metaphor" but for the update the list u can use Javascript between the "head" tag like this:
<head>
<script language=&quot;JavaScript&quot;><!--
function go(url) {
newUrl = url + '?' + (new Date()).getTime();
setTimeout('location.href= newUrl', 10000)
//if u want display result that the database has been
//update or some warning, then after 10s, it popup your
//cfm file
}
go('myupdatelist.cfm');
//--></script>
<title>your page here</title>
</head>

Let me know if this is what u r looking for.

GH
PS. Could u explain a little more &quot;side by side dialog metaphor&quot;, so I can find info for u?
[sig][/sig]
 
HI and thanks for the prompt response.
I have two lists, one of products I can choose from list-1), and the other is my current choices (list-2). I have two buttons, one which adds a hilited product in list-1 to list-2, and the other button removes a hilited item from list-2. The lists appear side-by-side on the screen, with the two buttons in between them.
I am looking for a Cold fusion tag that performs this function (as well as the other database stuff I mentioned in my original post).
Hope this clears up your question. By the way, I'm not a javascript programmer (yet, <grin>).
Regards,
Marsh. [sig][/sig]
 
Hi Marsh,
So you use a form with 2 lists (list1 for add stuff and list2 for remove stuff) and u have 2 buttons (ADD button and REMOVE button). U can display the 2 lists on ur page, right? U want:
1. when u click on ADD button, the list1 updated
2. when u click on REMOVE button, the list2 updated
Am I right? If not, let me know.
Here is my solution (if i am right):

<!-- ur update.cfm -->
<form action=&quot;dowhatitell.cfm&quot;>
<!-- code for ur 2 lists of option-->


<input type=&quot;submit&quot; name =&quot;updatebutton&quot; value=&quot;ADD&quot;>
<input type=&quot;submit&quot; name =&quot;updatebutton&quot; value=&quot;REMOVE&quot;>
</form>

-----
<!--This is ur dowhatitell.cfm -->
<cfif updatebutton is &quot;ADD&quot;>
<cfquery name=&quot;addlist&quot; datasource=&quot;mydb&quot;>
insert into mytable
values (.....)
</cfquery>
<cfelse>
<cfquery name=&quot;removelist&quot; datasource=&quot;mydb&quot;>
delete from mytable
values (.....)
</cfquery>
</cfif>
<html>
<head>
<script language=&quot;JavaScript&quot;><!--
function go(url) {
newUrl = url + '?' + (new Date()).getTime();
setTimeout('location.href= newUrl', 10000)
//if u want display result that the database has been
//update or some warning, then after 10s, it popup your
//cfm file
}
go('updatelist.cfm');
//--></script>
<title>your page here</title>
</head>
</html>


*note: For the SQL, I just type the algorithm, the syntax might be wrong, so check it for me.

I hope this helps (-:
GH
[sig][/sig]
 
Hi and thanks again. It's almost there. I can figure out the rest myself. After I get it going, I'll post a version here for everyone.
Regards,
Marsh. [sig][/sig]
 
Marsh,

Does my code help you at all? [sig]<p>GH ((-:<br><a href=mailto:giahan@hotmail.com>giahan@hotmail.com</a><br>(-:[/sig]
 
HI. Yes, your ideas and code were helpful. Thanks again.
Regards,
Marsh. [sig][/sig]
 
Marsh, did you get this working? I am going to need to
do a simular item soon..

Thanks.
[sig][/sig]
 
Hi BobLaw and yes, I'm just finishing it up for my client here. I'll need another day or two to get it right, then I'll post it for you. I was thinking of putting a small Access97 database with sample data in it so you have a fully working version.
What do you think?
Regards,
Marsh. [sig][/sig]
 
That would be great!

I wish I found this site sooner, I have picked up more tips in a few days then from reading the books for the last 3 weeks.

Thanks Marsh !
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top