Correct me if I'm wrong, but it sounds like you're trying to persist data in the text box so that users don't have to retype information if they click a button that triggers a post back or if they accidentally wander off the page etc.
In this case, is it necessary to set the text box to anything? I would suggest that an empty textbox is the best way to go. If you're setting it to 0 because the information is going into a DB field that doesn't allow nulls (a very good practice), I suggest allowing people to leave it blank and handle the problem when they submit the form. Rather than setting the textbox to 0 (which someone might delete anyway, causing validation problems) simply purify any response the user sends back. Check to see if text value of a field includes anything unacceptable and replace it with the default value you want, like swapping "" for "0" or whatever. But I think you'll have fewer problems handling this with validation than on the front end.
__________________
-------------------------
Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe
When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper
Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
|