Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Default Value on the web page  RSS feed

Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

My application has n number of fields. When user enters the data and submits the form, the form will be submitted and some business logic will be executed on the server side. If there are any validation errors, will be shown on the page. What I want to achieve is, I want to show a default amount of $0.00 in the amount field when the page is loaded for the first time. Right now, I've something like this..

So, when the form first loads, the payments object gets the value from database and pre-populates the amount field with database value. I don't want that value here. I just want a default $0 and when user enters some amount, I want to post it to the database.
Please note that, the form scope is currently request and I cannot make it to session for other reasons.

Any help is really appreciated.
Posts: 9550
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should have an action that prepares the form.  Set the default value for the field in that action.
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!