Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Repopulating fields?

 
rajesh mara
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have a doubt of how to repopulate fields with error messages below the fields when one of the fields left with blank.


For example

User name -------(Text Box)
Password ------ (Text Box)
Submit(Button)
if user doesn't enters user name or password i should get display like the following

User name -------(Text Box)
Password ------ (Text Box)
Submit(Button)
- User Name Required(in red marks)
please help me anyone how to get display like above instead of getting an alert prompt.

Thank You.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you using on the server? This is something easily accomplished in JSP.
 
rajesh mara
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how it can be achieved using jsp, it will be thankful if you send me an example using jsp i.e repopulating
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have all the information on the server -- including the nature of the error that your code just detected. It's an easy matter to use JSP technology to format the HTML as appropriate. You can conditionally create an error message on the page, and fill in the form fields with the previous submitted value for a parameter.

For example, assuming that the JSP is being generated in the same request as the form submission (not always true):



Conditional markup is easy with the JSTL <c:if> action:


[ June 17, 2007: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic