You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Silva <ms...@authenex.com> on 2002/08/30 20:15:39 UTC

text input and style sheets

Our HTML/design person has created our text input boxes with the following code

<input name="startDate" class="input" type="text" maxlength="10" size="10" value="01/01/2000">

I am trying to figure out a couple things...
1. How do I implement the class attribute within a stuts tag.  I am assuming this is a CSS thing, since I haven't used it before.  anyone know? 

2.  How do I set a default value for the input field?  if I said it explicitly like so:

	<input name="startDate" class="input" type="text" maxlength="10" size="10" value="01/01/2000">
	
	then the associated form does not repopulate the form field if there is an error.  is the only way to do this, to make it an initial value in the form object?


thanks, 
mark silva

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: text input and style sheets

Posted by Brian Hickey <bh...@r-effects.com>.
Mark,

Check the doc first, but I think you will find the following should work:


<html:text property="startDate" styleClass="input" type="text"
maxlength="10" cols="10"/>

this assumes you have a form bean with the get/set property named startDate
and containing a default value of "01/01/2000". If you don't want to access
the bean for a default, simply use the value= attribute to designate the
default.

Using a form bean has a benefit. You code the reset() and validate() methods
yourself. You control what the user sees on error.

Brian

----- Original Message -----
From: "Mark Silva" <ms...@authenex.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, August 30, 2002 2:15 PM
Subject: text input and style sheets


Our HTML/design person has created our text input boxes with the following
code

<input name="startDate" class="input" type="text" maxlength="10" size="10"
value="01/01/2000">

I am trying to figure out a couple things...
1. How do I implement the class attribute within a stuts tag.  I am assuming
this is a CSS thing, since I haven't used it before.  anyone know?

2.  How do I set a default value for the input field?  if I said it
explicitly like so:

<input name="startDate" class="input" type="text" maxlength="10" size="10"
value="01/01/2000">

then the associated form does not repopulate the form field if there is an
error.  is the only way to do this, to make it an initial value in the form
object?


thanks,
mark silva

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>