• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Text Field and default values

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a few text fields setup in a web application. When the user click the calculate button it needs to take the fields add them together and then populate another cell with that value.
(kinda like a spreadsheet).
Is there anyway to initialize the value of the text field to 0 (zero)without having it show the 0 (zero)??
If I set value=0 in the tag, the 0 shows up. If I set a defaultValue=0 I still get NaN as a result if any field is left blank.
Thanx
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would suggest storing the values of your text fields in variables before performing the calculation. Then perform the calculation on the variables instead of the text field values themselves. That way you can validate them and set them to 0 if they are "" before using them, and the user will not see the value in the text field.
[This message has been edited by Bodie Minster (edited March 21, 2001).]
 
ryan headley
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx, that's what we did, we just set the value="" then ran if statements on each variable and if == "" then we set it = to 0
thanx...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic