texbox data cleared - then clear variable

Discussion in 'ASP .Net' started by Tom, Aug 14, 2007.

  1. Tom

    Tom Guest

    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?
     
    Tom, Aug 14, 2007
    #1
    1. Advertising

  2. 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?
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Aug 14, 2007
    #2
    1. Advertising

  3. Tom

    Tom Guest

    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]" <> wrote
    in message news:...
    > 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?
     
    Tom, Aug 15, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    350
  2. Chad
    Replies:
    1
    Views:
    634
  3. David

    Response.Clear() doesn't clear

    David, Jan 31, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    1,047
    Mark Fitzpatrick
    Jan 31, 2008
  4. JP SIngh

    Session variable cleared by IIS

    JP SIngh, Jul 14, 2004, in forum: ASP General
    Replies:
    2
    Views:
    193
    Aaron [SQL Server MVP]
    Jul 14, 2004
  5. Replies:
    0
    Views:
    303
Loading...

Share This Page