View Full Version : I need a dynamic list
06-24-2002, 04:54 PM
I need to display a list of words, and allow the user to add or delete words from that list. Ideally that would happen dynamically, i.e. a word is selected and the 'delete' button is pressed. OR, the user types in a new word and clicks 'add'. The list is then updated to reflect the change.
I'm thinking this needs to be doable without having to re-build the entire web page just to show the update.
So, a multiple <SELECT> won't quite do it I think because the list of selectable items is static.
I can see initially building the list from an array (populated via an ADODB.recordset (that's Active Server Pages stuff) from the database) into a textarea, but dynamically updating it from that point has me stumped.
Would the task be easier if I did all the modification from a separate window? In other words I don't have to redraw/rebuild the main page every time I make a change. Even so, the technique/algorithm for a dynamic list is not evident to me.
06-24-2002, 08:02 PM
what about writing and retriving from a flat file, where the information is stored??
06-24-2002, 08:47 PM
Getting the data to/from the page isn't the problem (I'm using ASP & SQL Server 7, BTW). Rather, I want to be able to add/delete data (essentially a repeating data field).
You see this is a data entry screen and I want to avoid the whole cycle of "accept user changes, push data back to the server, update the database, fire stored procedure to fetch data via an ADO.recordset; populate HTML form objects w/ data, redisplay the screen " just to have an added element from a single field show up.
Beside the time lag (which may or may not be bad) submitting the page fires off the data validation for the entire <FORM>, and the user probably will not have gotten to other fields yet.
06-24-2002, 10:31 PM
what I was talking about was a flat file database, it's kinda like a database, and use a simple cgi script to access the file. its a lot faster than using a relational DB.
as far as your question, you might want to do the dynamic part first, I have a script for a client that lets her add/delete products and the first thing is does is ask how many items. then it passes that info back to the current page. (written in ASP) so the action of the form is the name of the current page.
after that it populates the other form fields with the information that was passed by the earlier form. I hope this helps a little
06-25-2002, 02:14 AM
I think what ecnarongi is trying to explain is how to pass dynamic stuff to a page that looks exactly the same, as WELL as form validation, at the same time.
Basically you look at what the user enters, and depending on YOUR decisions, you decide what to display, (redisplay the page, or validate the form, or thank the user?).
I often do this kind of thing, keeping the whole application within one page.
I hope this helps and does not confuse the issue. :)
I may be confused at his explanation... lol - but I know what he means basically since I do this kind of thing all the time.
06-27-2002, 02:01 PM
Yep, I think you are right. BTW thanks for the code sample.
That code sample is pretty good as a general template for selecting items for one list from another list. BTW I was able to cut a significant amount of code as I only need to "copy" items, not "move" them - and only do it one way, not both.
Also, in Netscape does the SELECT object not display scroll bar automatically when the list goes beyond the visible window? Why else code your own scroll functionality?
06-28-2002, 01:08 PM
There are buttons with "V" and "/\" respectively. OK, I didn't look at the code closely... Perhaps these SELECT the next item in the list when pressed, yes?
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.