473,756 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

texbox data cleared - then clear variable

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?
Aug 14 '07 #1
2 1625
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?
Aug 14 '07 #2
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.
"Peter Bromberg [C# MVP]" <pb*******@yaho o.yohohhoandabo ttleofrum.comwr ote
in message news:66******** *************** ***********@mic rosoft.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?

Aug 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7786
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
4
9904
by: karenmiddleol | last post by:
I have the following form the user enters the From and to period and presses the Submit button and the form fields are cleared once the submit button is pressed. Is there a way I can keep the Form fields visible and not cleared. Also when I display the message I want the original form cleared in a different version of this page how can I clear the form completely when I display the data entered from the Response statements I do not...
1
1340
by: Aparna Rege | last post by:
Hi, I am having trouble with a tab control. All the fields on the form are data bound and are spread over two tabs of a tab control. I have placed a Clear button with the code to clear all the fields on the form. When I click the Clear button, all the text boxes on the current tab get cleared. But when I go to the other tab, I see data in all the fields. When I come back to the previous tab, all the text boxes on this tab are now
1
3982
by: Robert Bravery | last post by:
Hi all, I'm using the following code to copy data from XL to the clipboard to be later usied in a datatable range = objSheet.get_Range("A22", "aa100"); range.Copy(Missing.Value).ToString(); xlcopydata = Clipboard.GetData(DataFormats.Text).ToString(); Clipboard.Clear(); But when I issue a excelapplication quite I get an dialog saying that I have large amounts of data on the clipboard, do I want to keep it etc etc
17
3554
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is populated when a user scans a label. The other is ScanDate - a date/time field that should equal the date/time of the scan (e.g. 7/31/2006 5:00:00 AM).
0
1999
by: Oliver Bleckmann | last post by:
hey guys, i have a little problem. my cgi routines are working so far, but i need to redirect to the cgi-programm and what the "posted" data to be cleared if redirected. i don't know how the post method exactly works. maybe i have to clear the stdin (tried fflush)!? maybe the is another reason that the former data is displayed. fist i thought of the browser cach, but it's the same problem using ctrl+f5. i need to check if the cgi program...
2
1343
by: boomcreation | last post by:
Hi, When I load a userControl, I check if I have a variable session. If my variableSession1 = "A" and do nothing. but if my variableSession1 = "B", I want clear the html in my control and write: "You need to do this or that"
3
3870
by: jobs | last post by:
I have a gridview on another page with a column that will link to this page. I'm flirting with design options, but am considering a template field with hyperlink navigateurl that includes a query string ? search=mydata container. My question/challenge, is that I want to use that query string to set a textbox on the called page, but then need the query string to no longer be visible in the url espectially after a refersh or other...
1
3855
by: Chad | last post by:
When I visit a specific web page, Request.aspx, for some reason my session variables are cleared. I noticed that there is a "EnableSessionState" property on the document object that has three allowed states "True", "false" and "Readonly". I would assume that by default, if not specified, it is "true". however, I decided to explicitly set it to true to see if it helps. i set it to true in the WebForm. no luck.. Then i realized that...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.