• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Repopulating fields?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
If you look closely at this tiny ad, you will see five bicycles and a naked woman:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic