Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-24-2002, 04:54 PM   PM User | #1
RadarBob
Regular Coder

 
Join Date: Jun 2002
Location: Round Rock, Texas
Posts: 443
Thanks: 0
Thanked 0 Times in 0 Posts
RadarBob is an unknown quantity at this point
Question I need a dynamic list

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.
RadarBob is offline   Reply With Quote
Old 06-24-2002, 08:02 PM   PM User | #2
ecnarongi
Regular Coder

 
Join Date: Jun 2002
Location: Northern NJ
Posts: 401
Thanks: 0
Thanked 1 Time in 1 Post
ecnarongi is an unknown quantity at this point
what about writing and retriving from a flat file, where the information is stored??
__________________
true lies
ecnarongi is offline   Reply With Quote
Old 06-24-2002, 08:47 PM   PM User | #3
RadarBob
Regular Coder

 
Join Date: Jun 2002
Location: Round Rock, Texas
Posts: 443
Thanks: 0
Thanked 0 Times in 0 Posts
RadarBob is an unknown quantity at this point
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.
RadarBob is offline   Reply With Quote
Old 06-24-2002, 10:31 PM   PM User | #4
ecnarongi
Regular Coder

 
Join Date: Jun 2002
Location: Northern NJ
Posts: 401
Thanks: 0
Thanked 1 Time in 1 Post
ecnarongi is an unknown quantity at this point
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
__________________
true lies
ecnarongi is offline   Reply With Quote
Old 06-25-2002, 02:14 AM   PM User | #5
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
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.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Old 06-27-2002, 02:01 PM   PM User | #6
RadarBob
Regular Coder

 
Join Date: Jun 2002
Location: Round Rock, Texas
Posts: 443
Thanks: 0
Thanked 0 Times in 0 Posts
RadarBob is an unknown quantity at this point
Smile

D.C.;
Yep, I think you are right. BTW thanks for the code sample.

I was not versed in the "new Option ()" call, which is the key to the whole thing (I told y'all I was new to javascript!).

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?
RadarBob is offline   Reply With Quote
Old 06-28-2002, 01:08 PM   PM User | #7
RadarBob
Regular Coder

 
Join Date: Jun 2002
Location: Round Rock, Texas
Posts: 443
Thanks: 0
Thanked 0 Times in 0 Posts
RadarBob is an unknown quantity at this point
Dave;
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?
RadarBob is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:53 AM.


Advertisement
Log in to turn off these ads.