[thelist] Value of Input with CSS
Diane Soini
dianesoini at earthlink.net
Fri Aug 13 19:38:36 CDT 2004
On Friday, August 13, 2004, at 01:42 PM,
thelist-request at lists.evolt.org wrote:
> I am aware that JS is capable of my request, but like I said, I need
> something that would work if the user has JS turned off. I was just
> curious
> if there was a style that could be applied to the empty text
> field...some
> sort of input style="whatever;" or
>
> input {
> background: url(link-to-text-file);
> }
How about
span.error { color:red; font-weight:bold; }
Put a <span id="error1" style="display:none;"> tag with the error text
next to each field, with a unique id for each one. When you validate
the page, if it's an error, toggle the display property to "inline".
The error messages won't be inside your text field, but displaying an
error next to the field is common. And probably a better solution since
someone could put erroneous data in the field and appreciate it not
disappearing or being replaced (so they don't have to type in the whole
thing again and can see their error).
Most people would use javascript for error checking, or check for
errors on the server. CSS can't validate your fields. If you allow the
form to be submitted for error checking on the server, you could then
return the user to the page with the display property having been
changed on the server. Otherwise, javascript would do the job.
More information about the thelist
mailing list