473,512 Members | 15,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox value and Javascript

Guys,
I have a web form with some <Asp:TextBox> controls, on some condition, I
need to trigger a client side JavaScript to clean all values of these boxes,
like below:

function DisableForm() {
document.getElementById("UserCtrl_Text_97").value = "";
document.getElementById("UserCtrl_Text_97").disabl ed = true;

document.getElementById("UserCtrl_Text_98").value = "";
document.getElementById("UserCtrl_Text_98").disabl ed = true;

document.getElementById("UserCtrl_Text_99").value = "";
document.getElementById("UserCtrl_Text_99").disabl ed = true;

document.getElementById("UserCtrl_Text_100").value = "";
document.getElementById("UserCtrl_Text_100").disab led = true;
}

The problem is, when I click "Save" button, all original data with these
text boxes are posted to server, instead of empty values.

Anybody knows why?

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
Nov 18 '05 #1
1 1505
When you disable a control, its values are not posted back. So the control
is pulling its previous value from viewstate.

HTH,

bill
"Hardy Wang" <ha*******@hotmail.com> wrote in message
news:uB**************@tk2msftngp13.phx.gbl...
Guys,
I have a web form with some <Asp:TextBox> controls, on some condition, I need to trigger a client side JavaScript to clean all values of these boxes, like below:

function DisableForm() {
document.getElementById("UserCtrl_Text_97").value = "";
document.getElementById("UserCtrl_Text_97").disabl ed = true;

document.getElementById("UserCtrl_Text_98").value = "";
document.getElementById("UserCtrl_Text_98").disabl ed = true;

document.getElementById("UserCtrl_Text_99").value = "";
document.getElementById("UserCtrl_Text_99").disabl ed = true;

document.getElementById("UserCtrl_Text_100").value = "";
document.getElementById("UserCtrl_Text_100").disab led = true;
}

The problem is, when I click "Save" button, all original data with these
text boxes are posted to server, instead of empty values.

Anybody knows why?

--
WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy

Nov 18 '05 #2

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

Similar topics

2
13678
by: anonieko | last post by:
This applies to javascript dynamic textbox onkey > > > Newsgroups: comp.lang.javascript From: Lasse Reichstein Nielsen <l...@hotpop.com> - Find messages by this author Date: Fri, 15 Jul 2005...
2
8374
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
9
10088
by: Jerry | last post by:
In limiting textbox input to 500 characters I would like to include a dynamic count of characters input while the user is typing into a textbox. This would obviously be a client side control,...
8
7382
by: Sergei | last post by:
Hi, I am displaying modal dialog and passing values from the main form to the modal dialog and back. It works fine but if I used the following syntax on Page_Load(just for testing) in VB to...
4
8657
by: Dabbler | last post by:
Is there a way to mark the text in a TextBox control as selected so when the user types a new value the existing text is replaced? Thanks
1
3194
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
8
5732
by: nil | last post by:
Hello all, It's urgent... i want to add autocomplete textbox facility in my application like google. as you type it suggests option to the user..i want the same kind of facility...i know i...
6
8035
Coldfire
by: Coldfire | last post by:
I am having problems with Maxlength of Multiline "Textbox". I have browsed alot to find the solution. Tons of javascripts have been found but they all deal with <asp:textarea >............. and...
2
4887
by: =?Utf-8?B?SmVycnkgSg==?= | last post by:
Hello, I am using asp.net 2003 using C#. I am creating textboxes dynamically and want to validate to make sure the user can only input an integer. I don't think I can use the validators...
0
7252
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,...
0
7153
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...
0
7371
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,...
0
5676
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,...
0
4743
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
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...

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.