![]() |
texbox data cleared - then clear variable
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? |
RE: texbox data cleared - then clear variable
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 "Tom" wrote: > 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? |
Re: texbox data cleared - then clear variable
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. "Peter Bromberg [C# MVP]" <pbromberg@yahoo.yohohhoandabottleofrum.com> wrote in message news:66780FAA-9B92-418C-8E27-FD9937778083@microsoft.com... > 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 > > > > "Tom" wrote: > >> 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? |
| All times are GMT. The time now is 01:51 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.