aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Removing the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Removing the "null" test from textfields" Watch "Removing the "null" test from textfields" New topic

Removing the "null" test from textfields

Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295

I need some idea in this regard.

The Scenario :

I have a page, where I have to display some fields, which are brought from database.

Before the records are fetched, the textfields show "null". I can get rid of this using script.

I want to know whether, we can make a generalized script, which could be used to check all the textfields, in a page and then, set a value of "", when it is null?

Is there a way to get all the textfields in a script?

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
This code may be what you are looking for:

You call it with:

There is one problem with this logic, if a person has JavaScript disabled, then the field values will still be set to the inital value since the code can not run.

It is sorta covered in the JavaRanch Style Guide.
subject: Removing the "null" test from textfields