texbox data cleared - then clear variable

T

Tom

I have a textbox on my web form were users can enter in 1 name or many names. The form then validates the name against the database.
If the name is valid its then saved into a varaible to be used at a later time. The issue I'm having is as follows:

the user enters in 2 names
John, Greg

clicks my valid button they're both valid so both names are stored in the variable so my variable looks like
John,Greg and both are in the textbox.

Now, the issue:
If the user clicks valid the variable gets populated, then the user decides to remove a name so it looks like this in the textbox
John

then they click valid, but the textbox still shows
John, Greg even though Greg was removed

Is there a way to determine if a name was removed or if the textbox was cleared and the user entered in new names?
such as this

first time entered:
John, Greg

user deletes both names and enters after the variable was populated
Stacey, Michelle

so when they click validate this time, I only want to see
Stacey, Michelle and not
John,Greg, Stacey,Michelle.

what is the best way to determine if the names changed after getting validated?

I saw another question like this, and I tried the replies to that but no success, any other suggestions?
 
G

Guest

In the scenario that you have put yourself into here, you need to split the
TextBox contents into a string array on the comma delimiter, iterate over
every item in the array and check if it is already present in your storage
object. And you have to check your storage items and make sure it doesn't
still contain a name that the user has subsequently removed from the textbox.
In sum, IMHO, you've got a real mess on your hands. Is there any reason why
you can't come up with a more usable approach?
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
 
T

Tom

I agree with you 100000%. I'm just coding to the requirements and even
though I mentioned that its not really going to work correctly it doesn't
matter.

Currently I have the textbox information coming through as a string array
seperated by (;), I then take that and split it and take each name and
validate the name. If valid, show in the textbox and store in my variable so
I can keep adding valid names to it. If not valid, then its not added to the
varaible and a message is shown to the user, (invalid user).

but the user can now, delete all the valid names in the textbox and start
over and click the valid button again and go through the process again.

so i'm not finding a clear cut way to do this and have it work 100%. I've
tried a ton of different scenarios and none are successfull.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top