delete text in a textbox

M

Mike

Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a button to see if the product numbers(s) exists in our database, if they exist then the product name is returned and the product number is then replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and enter in new ones and click the button. When this happens the old product names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox, and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets product name, Then the user deletes everything in the textbox and enters in new product ID's and clicks enter. In this case I only need to show the new products entered and not the old products and new products.


how can this be done?
I'm using a asp:textbox on the server, validating on the server
 
R

RSH

mike,

i would say you could implement some javascript client side that would fire onchange in the appropriate textbox. You could store the previous text in a variable and perform conditionals in the onchange event handler. I use this type of procedure often, in some cases enabling and disabling ctontrols as well as clearing and repopulating controls as needed. Powerful UI stuff for sure.

HTH,
Ron

Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a button to see if the product numbers(s) exists in our database, if they exist then the product name is returned and the product number is then replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and enter in new ones and click the button. When this happens the old product names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox, and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets product name, Then the user deletes everything in the textbox and enters in new product ID's and clicks enter. In this case I only need to show the new products entered and not the old products and new products.


how can this be done?
I'm using a asp:textbox on the server, validating on the server
 
P

Patrice

Not sure to understand the exact problem but I believe it could be simpler not to use the input textbox to display the output. This way on each postback you have just to display somewhere else the productnames for the IDs that are currently in the *input IDs* textbox.

For now it looks like to me that you record those productname somewhere server side as each id is added and that you never clear this list ???

---
Patrice


"Mike" <[email protected]> a écrit dans le message de news: (e-mail address removed)...
Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a button to see if the product numbers(s) exists in our database, if they exist then the product name is returned and the product number is then replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and enter in new ones and click the button. When this happens the old product names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox, and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets product name, Then the user deletes everything in the textbox and enters in new product ID's and clicks enter. In this case I only need to show the new products entered and not the old products and new products.


how can this be done?
I'm using a asp:textbox on the server, validating on the server
 
M

MasterGaurav \(www.edujini-labs.com\)

Where's your variable? I mean... is it part of the Page?
Not quite sure if I have really understood your model... but have you looked
into ViewState?

--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------


Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a
button to see if the product numbers(s) exists in our database, if they
exist then the product name is returned and the product number is then
replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and
enter in new ones and click the button. When this happens the old product
names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep
adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox,
and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in
the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if
they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets
product name, Then the user deletes everything in the textbox and enters in
new product ID's and clicks enter. In this case I only need to show the new
products entered and not the old products and new products.


how can this be done?
I'm using a asp:textbox on the server, validating on the server
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top