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.
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.
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
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?