473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

text box changes

have written a code for textbox in jsp

[HTML]<td><input type="text" class="textBox" name="potCommission" id="potCommission" size="10" value='<%=commission%>'
<% if(!commissionFlag.equals("NG")){ %> disabled="true" <%}%> ></td>[/HTML]

whenever the page loads the textbox contains the same value the user has typed in. I want it to be defaulted it to '0.00' whenever the page is refreshed. any inputs?
Jan 11 '08 #1
4 1995
sumittyagi
202 Expert 100+
have written a code for textbox in jsp

[HTML]<td><input type="text" class="textBox" name="potCommission" id="potCommission" size="10" value='<%=commission%>'
<% if(!commissionFlag.equals("NG")){ %> disabled="true" <%}%> ></td>[/HTML]

whenever the page loads the textbox contains the same value the user has typed in. I want it to be defaulted it to '0.00' whenever the page is refreshed. any inputs?
Try this:
[HTML]<body onload="document.getElementById('potCommission').v alue='0.00' ">
..
..
<td><input type="text" class="textBox" name="potCommission" id="potCommission" size="10" value='<%=commission%>'
<% if(!commissionFlag.equals("NG")){ %> disabled="true" <%}%> ></td>[/HTML]
Jan 14 '08 #2
rsrinivasan
221 100+
have written a code for textbox in jsp

[HTML]<td><input type="text" class="textBox" name="potCommission" id="potCommission" size="10" value='<%=commission%>'
<% if(!commissionFlag.equals("NG")){ %> disabled="true" <%}%> ></td>[/HTML]

whenever the page loads the textbox contains the same value the user has typed in. I want it to be defaulted it to '0.00' whenever the page is refreshed. any inputs?
Another method is you can set 0.00 as the default value in your form class.

that is,
In the form class
.....
.....
private int potCommission = 0.00;
....
.....

getter/setter method.
Jan 14 '08 #3
sumittyagi
202 Expert 100+
Another method is you can set 0.00 as the default value in your form class.

that is,
In the form class
.....
.....
private int potCommission = 0.00;
....
.....

getter/setter method.
This wouldn't work when you refresh a page. As previous request is resubmitted when you refresh the page, so server will serve you the same result(as HTTP is a stateless protocol).

Note: My solution is specifically for solving lavanyak6's question, and not the best practice to do, as some mechanism should be applied at server-side for preventing submittion of same request more than once due to refreshing the page.
Again for some scenarios it doesn't matter, and for some, it does.
Jan 14 '08 #4
RedSon
5,000 Expert 4TB
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

acoder has taken care of it for you this time.

MODERATOR
Jan 14 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Ed Suominen | last post by:
I'm thinking of implementing a real-time collaborative text editor in Python using Twisted. An initial plan is to use a Twisted PB server daemon that accepts user:password:file connections from...
1
by: JLuppens | last post by:
Does anyone know if there is a way to track changes in a text field like word does? I am using a SQL2000 database and can use either VB.Net or Access. The field is either ntext or Varchar. I...
4
by: gj | last post by:
Hi, I'm trying to update a sql database from a web form using text boxes. I'm trying to learn C# on my own so I am at a complete loss. I created my sql connection, data adapter, dataset and data...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
5
by: Steve S | last post by:
Heres what I want to do...User types into a texbox, clicks a button, the button saves that text to a file. The problem is that when I click the submit button, any changes made to the textbox are...
6
by: Lance Geeck | last post by:
I have a simple form where I am using a dataset called Client. On the data entry screen, there are name, address, city state and zip. I have the fields bound to the dataset field. (Properties...
8
by: addoty | last post by:
We have a web application that has a lot of large textareas for data collection. We need to track who makes changes, when and what changes were made. Right now I'm storing the entire text in a...
18
by: Academia | last post by:
I let the use modify the text of a combobox and then I replace the selected item with the new text (in Keyup event). But if he sets the Text property to an empty string ("") that sets the...
1
by: =?ISO-8859-1?Q?S=F8ren?= | last post by:
Hi guys I got the following code: ------------------------------------------------------- Dim Word As New Microsoft.Office.Interop.Word.Application Dim Document As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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,...

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.