• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Changing textfield bgcolour upon entering data  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I have the following problem and was wondering if I could do this with JSP.

Basically I have a form with which I enter data into a database.
In the form are textfields. One of the textfields is for numbers only.
Upon entering numbers within the textfield I want it to change its background colour. For example: If its below 8 digits the bgcolour is yellow , if its exactly 8 its green and if its over 8 its red.

Is it possible to do this with JSP ?
If yes , how ?

Thanks for your help.

Cheers,

Rouven
 
author & internet detective
Posts: 39083
714
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rouven,
You actually want to use JavaScript on the page to update the CSS for that textfield. I'll move this to our HTML forum where they are experts at that sort of thing.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe this is what you wanted:



You probably want to change the colors so they are lighter in color. I picked the basic red, green, and yellow color codes.

Eric
[ June 01, 2008: Message edited by: Eric Pascarello ]
 
Marshal
Posts: 67197
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Rouven Withake:
Is it possible to do this with JSP ?


As has been pointed out, no.

JSP executes on the server in order to format the HTML page to send to the client. Once at the browser, client-side technologies such as JavaScript need to be used.

Perhaps this article will be helpful.
 
Rouven Withake
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your help

Rouven
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!