Since you are just populating a field, JavaScript is an acceptable solution.
It should go without saying that you are doing server-side form validation
anyway so it shouldn't be a problem in this case.  Remember server-side
validation is a necessity.  Client-side validation (ie JavaScript) should be
thought of as a luxury for the user's convenience, but cannot be relied on
as the soul means of ensuring you are getting valid data sent to the server.

As far as pre-populating a form, in general my understanding has been that
the preferred way to do this in the Action (someone please correct me if I
am mistaken), particularly if you want to pre-populate the form with data
from your model.  But if all you are worried about is setting that date
field, JavaScript would be a cheap way to do it if it is a non-critical
issue.

Jason

----- Original Message -----
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, March 05, 2002 2:28 PM
Subject: RE: Pre Populating Fields - bit of a newbie question


> This is an old, outdated argument; 99.99 percent of the web uses
JavaScript.
> Instantiating an object is very expensive, relatively speaking.  But it's
> your app; do what you want.
>
> Mark
>
> -----Original Message-----
> From: Jay sissom [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 05, 2002 1:07 PM
>
> You can use JavaScript only if you guarantee that every user of your
> application has a browser that supports JavaScript and it is enabled.
> You're probably OK if you are intranet, but with internet applications,
> you never know if someone is running WebTV or something like that.
>
> In my mind, the point of creating an object for this is to make sure I get
> a date even if JavaScript isn't enabled in the user's browser.  The time
> to get a date is in milliseconds I would bet.  It's not much overhead at
> all.
>
>
> On Tue, 5 Mar 2002, Galbreath, Mark wrote:
>
> > Use JavaScript.  What's the point of having the overhead of creating an
> > object for something as simple as getting the current date?
> >
> > Mark
> >
> > -----Original Message-----
> > From: Mattos, John [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, March 05, 2002 12:28 PM
> >
> > I need to have a startDate and endDate field in my form, and I'd like to
> > prepopulate the endDate field with today's date. There's a bean that has
> > set/getEndDate() methods, and I get to the form from an Action.perform()
> > call
> >
> > What's the best way to prepopulate that field?
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to