Using <html:reset/> or <html:cancel> does not clear the entered data to
defaults.  This is before a submit, typically when a user has entered a
bunch of data and realized he was looking at the wrong ledger and wants to
reset everything to 0.  It's not working. And this shouldn't be rocket
science!  :-)

Mark

-----Original Message-----
From: James Mitchell [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 10, 2003 3:21 PM
To: Struts Users Mailing List
Subject: Re: <html:reset> and <html:cancel>


On Tuesday 10 June 2003 15:00, Mark Galbreath wrote:
> Close - <input type="reset"/> and <html:reset/> both clear <input 
> type="text"/> but neither clear <html:text/>.  Until Struts, I always 
> used <input type="reset"/> to clear the textfields of a form and 
> assumed <html:reset/> would do the same.  So my original question is, 
> what intrinsic value does <html:reset/> have for <html:text/> objects 
> if they cannot clear them or reset them to their default values on the 
> client?  RU saying that I have to create a custom clear() function to 
> clear <html:text/> objects on the client side (or is this even 
> possible on the client)?

Yes and no, when the page is rendered, the values you see are those input's 
default values, so hitting reset will change them back to their default 
values (values they had when the page was loaded).  If this happens to be a 
new form (such as creating a new registration in the struts-example), then 
those fields are typically emtpy (exeption being default values that may
have 
been used).  

>From here, if you fill out the entire form, then hit "reset", the fields
will 
revert to their values that were there when the page was rendered.

However, if you hit enter after filling out the form, but validation fails
and 
you are brought back to the jsp to fill in...oh, let's say a required field 
that was left blank, then hitting reset at that point "looks" like it does 
nothing, hence the confusion.

A "clear" can be implemented either on the client or the server (it's your 
choice).  For client approach, you must do as you suggested (JavaScript, 
isn't it wonderful?).  For a server-side "clear", just use html:cancel but 
change it to show "Reset" (<html:cancel value="Reset">).  Read up on the 
docos for this one.  There are a couple of gotcha's.

So, I hope this "clear"s things up ;)

>
> Mark
>
> -----Original Message-----
> From: James Mitchell [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 10, 2003 2:51 PM
> To: Struts Users Mailing List
> Subject: Re: <html:reset> and <html:cancel>
>
> On Tuesday 10 June 2003 14:30, Mark Galbreath wrote:
> > Is it just me, or do these objects have no intrinsic affect on 
> > <html:text> objects?
>
> From which perspective do you mean?  Client or server?
>
> The reset is basically an html input of type reset which will effect 
> the page on the client side, while the cancel submit the form, but 
> signals the controller that the form was cancelled (server side).
>
> I doubt you suffer from this, but I've seen several cases where 
> developers think that if the user fills out a form and submits it, but 
> it fails on validation and returns to render the page with those 
> invalid entries, that hitting the reset will "reset" (in their mind) 
> the page back to a blank page.
>
> That, of course, is the difference betwee a "reset" and a "clear" 
> button.
>
> Have I come close to answering your question?
>
> > Mark
> >
> >
> >
> > --------------------------------------------------------------------
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]

-- 
James Mitchell
Software Developer/Struts Evangelist http://www.struts-atlanta.org
770-822-3359 AIM:jmitchtx



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




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

Reply via email to