Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Reset button & Validation Error

Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form "ModfyUserForm" with "Submit" button and a "Reset" button. The form is prepopulated depending on what user is selected from a dropdown list. When you edit a certain field in the form and before clikcing Submit you click Reset my previous data is loaded back in the form. But while modifying if any field(like emailaddress field) is empty I throw a Validation Error.
But after the Validation Error if I click the Reset button the old values are not retrieved and the form is not populated with the old data. Is there a way to make this...if could you please let me know.
Thanks in advance.
Posts: 15627
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reset restores fields with the values they had when the page was originally loaded. When you come back with validation errors, the data that you validated now become the original values. The values that you had before validation are lost. The only way you can restore the values you really wanted would be to change your reset button to a submit button and pull the original values back into the form fields on the server side. That is, instead of
<html:reset />
you would have
Anderson gave himself the promotion. So I gave myself this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic