You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Edgar <ro...@hkstar.com> on 2000/07/07 05:03:13 UTC

Form/Submit tags suggestion

A suggestion,

The form tag wont acept an onsubmit event and the submit button wont accept
an onclick event.

I need to do some processing immediately before submitting the
form(accumulating 120 checkboxes into a single hidden tag so it can be
passed to a form property).

Of course I can just remove the struts submit button and replace with a
standard button but it would be nice to just be able to us the tags and set
the events....



BTW
Can a form property be somehting other than a string??
Rob


Re: Form/Submit tags suggestion

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
David Chisholm wrote:

> I think your right.  Supporting indexed properties would be a nice
> improvement though.
> David

There has been some code submitted (by Ralph Schaer) to deal with sets
of
checkboxes that I haven't had a chance to add yet ... but better support
for
this is coming.

Craig


>
> > -----Original Message-----
> > From: Robert Edgar [mailto:robedgar@hkstar.com]
> > Sent: Friday, July 07, 2000 8:39 AM
> > To: struts-user@jakarta.apache.org
> > Subject: RE: Form/Submit tags suggestion
> >
> >
> > Well its different to the extent of trying to have the ActionForm
> > object be
> > auto loaded with the data.
> >
> > AFAIK struts only handles simple strings rather than arrays of strings.
> >
> >
> > Rob
> >
> > -----Original Message-----
> > From: David Chisholm [mailto:David_Chisholm@i2.com]
> > Sent: Friday, July 07, 2000 9:36 PM
> > To: struts-user@jakarta.apache.org
> > Subject: RE: Form/Submit tags suggestion
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: Robert Edgar [mailto:robedgar@hkstar.com]
> > > Sent: Friday, July 07, 2000 1:04 AM
> > > To: struts-user@jakarta.apache.org
> > > Subject: RE: Form/Submit tags suggestion
> > >
> > >
> > > Thanks,
> > > Sorry should have RTFM....
> > >
> > > The hours are long and I am getting tired :-))
> > >
> > > On types, I was just thinking of whether there was a simpler way
> > > of handling
> > > arrays of controls, ie I have 3 sets of 40 checkboxes allowing
> > someone to
> > > select the type of news they are interested in, I dont feel
> > like having 40
> > > properties on the form object (and in any case it would then break if I
> > > added a new news item) so I have a js function to run over all
> > > the controls
> > > and concat the values in to a CSV string which I pass to a single
> > > property(though this is quite slow).
> > >
> >
> >
> > Is this somehow different than assigning all of the checkbox
> > fields with the
> > same name, and then using ServletRequest.getParameterValues(String) to get
> > an array of the parameter values?
> > David
> >
> >
> > > Yea like the client side script auto validation, we are doing
> > this now but
> > > we keep the validation routines in a seperate js file then call
> > > the routine
> > > from the onblur for a field or the onsubmit for the form but it would be
> > > neat to have this auto generated
> > >
> > > Rob
> > >
> > >
> > > -----Original Message-----
> > > From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> > > Sent: Friday, July 07, 2000 1:31 PM
> > > To: struts-user@jakarta.apache.org
> > > Subject: Re: Form/Submit tags suggestion
> > >
> > >
> > > Robert Edgar wrote:
> > >
> > > > A suggestion,
> > > >
> > > > The form tag wont acept an onsubmit event and the submit button wont
> > > accept
> > > > an onclick event.
> > > >
> > > > I need to do some processing immediately before submitting the
> > > > form(accumulating 120 checkboxes into a single hidden tag so it can be
> > > > passed to a form property).
> > > >
> > > > Of course I can just remove the struts submit button and
> > replace with a
> > > > standard button but it would be nice to just be able to us
> > the tags and
> > > set
> > > > the events....
> > > >
> > >
> > > Both of these are legal ... it's just that Struts, like all XML
> > > applications,
> > > is case sensitive and I chose a different capitalization for these
> > > attributes
> > > (see the tags.html file in the "struts-documentation" file for
> > the correct
> > > capitalization).
> > >
> > > Try <struts:form ... onSubmit="xxx"/> and <struts:submit ...
> > > onClick="xxx"/>.
> > >
> > > >
> > > > BTW
> > > > Can a form property be somehting other than a string??
> > > > Rob
> > >
> > > At the moment it cannot.  On the client side, I don't see a lot
> > > of room for
> > > changing this.  However, what I'm interested in exploring is the idea of
> > > adding
> > > a "validate" attribute on the input fields like "text" that
> > would generate
> > > JavaScript code to validate things like "this field is
> > required" and "this
> > > field must be a date".  On the server end, though, the parameter
> > > values are
> > > still going to come in as strings because of the way that the
> > > HTTP protocol
> > > (and the servlet API) are defined.
> > >
> > > Craig
> > >
> > >
> >

RE: Form/Submit tags suggestion

Posted by David Chisholm <Da...@i2.com>.
I think your right.  Supporting indexed properties would be a nice
improvement though.
David


> -----Original Message-----
> From: Robert Edgar [mailto:robedgar@hkstar.com]
> Sent: Friday, July 07, 2000 8:39 AM
> To: struts-user@jakarta.apache.org
> Subject: RE: Form/Submit tags suggestion
>
>
> Well its different to the extent of trying to have the ActionForm
> object be
> auto loaded with the data.
>
> AFAIK struts only handles simple strings rather than arrays of strings.
>
>
> Rob
>
> -----Original Message-----
> From: David Chisholm [mailto:David_Chisholm@i2.com]
> Sent: Friday, July 07, 2000 9:36 PM
> To: struts-user@jakarta.apache.org
> Subject: RE: Form/Submit tags suggestion
>
>
>
>
> > -----Original Message-----
> > From: Robert Edgar [mailto:robedgar@hkstar.com]
> > Sent: Friday, July 07, 2000 1:04 AM
> > To: struts-user@jakarta.apache.org
> > Subject: RE: Form/Submit tags suggestion
> >
> >
> > Thanks,
> > Sorry should have RTFM....
> >
> > The hours are long and I am getting tired :-))
> >
> > On types, I was just thinking of whether there was a simpler way
> > of handling
> > arrays of controls, ie I have 3 sets of 40 checkboxes allowing
> someone to
> > select the type of news they are interested in, I dont feel
> like having 40
> > properties on the form object (and in any case it would then break if I
> > added a new news item) so I have a js function to run over all
> > the controls
> > and concat the values in to a CSV string which I pass to a single
> > property(though this is quite slow).
> >
>
>
> Is this somehow different than assigning all of the checkbox
> fields with the
> same name, and then using ServletRequest.getParameterValues(String) to get
> an array of the parameter values?
> David
>
>
> > Yea like the client side script auto validation, we are doing
> this now but
> > we keep the validation routines in a seperate js file then call
> > the routine
> > from the onblur for a field or the onsubmit for the form but it would be
> > neat to have this auto generated
> >
> > Rob
> >
> >
> > -----Original Message-----
> > From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> > Sent: Friday, July 07, 2000 1:31 PM
> > To: struts-user@jakarta.apache.org
> > Subject: Re: Form/Submit tags suggestion
> >
> >
> > Robert Edgar wrote:
> >
> > > A suggestion,
> > >
> > > The form tag wont acept an onsubmit event and the submit button wont
> > accept
> > > an onclick event.
> > >
> > > I need to do some processing immediately before submitting the
> > > form(accumulating 120 checkboxes into a single hidden tag so it can be
> > > passed to a form property).
> > >
> > > Of course I can just remove the struts submit button and
> replace with a
> > > standard button but it would be nice to just be able to us
> the tags and
> > set
> > > the events....
> > >
> >
> > Both of these are legal ... it's just that Struts, like all XML
> > applications,
> > is case sensitive and I chose a different capitalization for these
> > attributes
> > (see the tags.html file in the "struts-documentation" file for
> the correct
> > capitalization).
> >
> > Try <struts:form ... onSubmit="xxx"/> and <struts:submit ...
> > onClick="xxx"/>.
> >
> > >
> > > BTW
> > > Can a form property be somehting other than a string??
> > > Rob
> >
> > At the moment it cannot.  On the client side, I don't see a lot
> > of room for
> > changing this.  However, what I'm interested in exploring is the idea of
> > adding
> > a "validate" attribute on the input fields like "text" that
> would generate
> > JavaScript code to validate things like "this field is
> required" and "this
> > field must be a date".  On the server end, though, the parameter
> > values are
> > still going to come in as strings because of the way that the
> > HTTP protocol
> > (and the servlet API) are defined.
> >
> > Craig
> >
> >
>


RE: Form/Submit tags suggestion

Posted by Robert Edgar <ro...@hkstar.com>.
Well its different to the extent of trying to have the ActionForm object be
auto loaded with the data.

AFAIK struts only handles simple strings rather than arrays of strings.


Rob

-----Original Message-----
From: David Chisholm [mailto:David_Chisholm@i2.com]
Sent: Friday, July 07, 2000 9:36 PM
To: struts-user@jakarta.apache.org
Subject: RE: Form/Submit tags suggestion




> -----Original Message-----
> From: Robert Edgar [mailto:robedgar@hkstar.com]
> Sent: Friday, July 07, 2000 1:04 AM
> To: struts-user@jakarta.apache.org
> Subject: RE: Form/Submit tags suggestion
>
>
> Thanks,
> Sorry should have RTFM....
>
> The hours are long and I am getting tired :-))
>
> On types, I was just thinking of whether there was a simpler way
> of handling
> arrays of controls, ie I have 3 sets of 40 checkboxes allowing someone to
> select the type of news they are interested in, I dont feel like having 40
> properties on the form object (and in any case it would then break if I
> added a new news item) so I have a js function to run over all
> the controls
> and concat the values in to a CSV string which I pass to a single
> property(though this is quite slow).
>


Is this somehow different than assigning all of the checkbox fields with the
same name, and then using ServletRequest.getParameterValues(String) to get
an array of the parameter values?
David


> Yea like the client side script auto validation, we are doing this now but
> we keep the validation routines in a seperate js file then call
> the routine
> from the onblur for a field or the onsubmit for the form but it would be
> neat to have this auto generated
>
> Rob
>
>
> -----Original Message-----
> From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Sent: Friday, July 07, 2000 1:31 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: Form/Submit tags suggestion
>
>
> Robert Edgar wrote:
>
> > A suggestion,
> >
> > The form tag wont acept an onsubmit event and the submit button wont
> accept
> > an onclick event.
> >
> > I need to do some processing immediately before submitting the
> > form(accumulating 120 checkboxes into a single hidden tag so it can be
> > passed to a form property).
> >
> > Of course I can just remove the struts submit button and replace with a
> > standard button but it would be nice to just be able to us the tags and
> set
> > the events....
> >
>
> Both of these are legal ... it's just that Struts, like all XML
> applications,
> is case sensitive and I chose a different capitalization for these
> attributes
> (see the tags.html file in the "struts-documentation" file for the correct
> capitalization).
>
> Try <struts:form ... onSubmit="xxx"/> and <struts:submit ...
> onClick="xxx"/>.
>
> >
> > BTW
> > Can a form property be somehting other than a string??
> > Rob
>
> At the moment it cannot.  On the client side, I don't see a lot
> of room for
> changing this.  However, what I'm interested in exploring is the idea of
> adding
> a "validate" attribute on the input fields like "text" that would generate
> JavaScript code to validate things like "this field is required" and "this
> field must be a date".  On the server end, though, the parameter
> values are
> still going to come in as strings because of the way that the
> HTTP protocol
> (and the servlet API) are defined.
>
> Craig
>
>


RE: Form/Submit tags suggestion

Posted by David Chisholm <Da...@i2.com>.

> -----Original Message-----
> From: Robert Edgar [mailto:robedgar@hkstar.com]
> Sent: Friday, July 07, 2000 1:04 AM
> To: struts-user@jakarta.apache.org
> Subject: RE: Form/Submit tags suggestion
>
>
> Thanks,
> Sorry should have RTFM....
>
> The hours are long and I am getting tired :-))
>
> On types, I was just thinking of whether there was a simpler way
> of handling
> arrays of controls, ie I have 3 sets of 40 checkboxes allowing someone to
> select the type of news they are interested in, I dont feel like having 40
> properties on the form object (and in any case it would then break if I
> added a new news item) so I have a js function to run over all
> the controls
> and concat the values in to a CSV string which I pass to a single
> property(though this is quite slow).
>


Is this somehow different than assigning all of the checkbox fields with the
same name, and then using ServletRequest.getParameterValues(String) to get
an array of the parameter values?
David


> Yea like the client side script auto validation, we are doing this now but
> we keep the validation routines in a seperate js file then call
> the routine
> from the onblur for a field or the onsubmit for the form but it would be
> neat to have this auto generated
>
> Rob
>
>
> -----Original Message-----
> From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Sent: Friday, July 07, 2000 1:31 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: Form/Submit tags suggestion
>
>
> Robert Edgar wrote:
>
> > A suggestion,
> >
> > The form tag wont acept an onsubmit event and the submit button wont
> accept
> > an onclick event.
> >
> > I need to do some processing immediately before submitting the
> > form(accumulating 120 checkboxes into a single hidden tag so it can be
> > passed to a form property).
> >
> > Of course I can just remove the struts submit button and replace with a
> > standard button but it would be nice to just be able to us the tags and
> set
> > the events....
> >
>
> Both of these are legal ... it's just that Struts, like all XML
> applications,
> is case sensitive and I chose a different capitalization for these
> attributes
> (see the tags.html file in the "struts-documentation" file for the correct
> capitalization).
>
> Try <struts:form ... onSubmit="xxx"/> and <struts:submit ...
> onClick="xxx"/>.
>
> >
> > BTW
> > Can a form property be somehting other than a string??
> > Rob
>
> At the moment it cannot.  On the client side, I don't see a lot
> of room for
> changing this.  However, what I'm interested in exploring is the idea of
> adding
> a "validate" attribute on the input fields like "text" that would generate
> JavaScript code to validate things like "this field is required" and "this
> field must be a date".  On the server end, though, the parameter
> values are
> still going to come in as strings because of the way that the
> HTTP protocol
> (and the servlet API) are defined.
>
> Craig
>
>


RE: Form/Submit tags suggestion

Posted by Robert Edgar <ro...@hkstar.com>.
Thanks,
Sorry should have RTFM....

The hours are long and I am getting tired :-))

On types, I was just thinking of whether there was a simpler way of handling
arrays of controls, ie I have 3 sets of 40 checkboxes allowing someone to
select the type of news they are interested in, I dont feel like having 40
properties on the form object (and in any case it would then break if I
added a new news item) so I have a js function to run over all the controls
and concat the values in to a CSV string which I pass to a single
property(though this is quite slow).

Yea like the client side script auto validation, we are doing this now but
we keep the validation routines in a seperate js file then call the routine
from the onblur for a field or the onsubmit for the form but it would be
neat to have this auto generated

Rob


-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: Friday, July 07, 2000 1:31 PM
To: struts-user@jakarta.apache.org
Subject: Re: Form/Submit tags suggestion


Robert Edgar wrote:

> A suggestion,
>
> The form tag wont acept an onsubmit event and the submit button wont
accept
> an onclick event.
>
> I need to do some processing immediately before submitting the
> form(accumulating 120 checkboxes into a single hidden tag so it can be
> passed to a form property).
>
> Of course I can just remove the struts submit button and replace with a
> standard button but it would be nice to just be able to us the tags and
set
> the events....
>

Both of these are legal ... it's just that Struts, like all XML
applications,
is case sensitive and I chose a different capitalization for these
attributes
(see the tags.html file in the "struts-documentation" file for the correct
capitalization).

Try <struts:form ... onSubmit="xxx"/> and <struts:submit ...
onClick="xxx"/>.

>
> BTW
> Can a form property be somehting other than a string??
> Rob

At the moment it cannot.  On the client side, I don't see a lot of room for
changing this.  However, what I'm interested in exploring is the idea of
adding
a "validate" attribute on the input fields like "text" that would generate
JavaScript code to validate things like "this field is required" and "this
field must be a date".  On the server end, though, the parameter values are
still going to come in as strings because of the way that the HTTP protocol
(and the servlet API) are defined.

Craig



Re: Form/Submit tags suggestion

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Robert Edgar wrote:

> A suggestion,
>
> The form tag wont acept an onsubmit event and the submit button wont accept
> an onclick event.
>
> I need to do some processing immediately before submitting the
> form(accumulating 120 checkboxes into a single hidden tag so it can be
> passed to a form property).
>
> Of course I can just remove the struts submit button and replace with a
> standard button but it would be nice to just be able to us the tags and set
> the events....
>

Both of these are legal ... it's just that Struts, like all XML applications,
is case sensitive and I chose a different capitalization for these attributes
(see the tags.html file in the "struts-documentation" file for the correct
capitalization).

Try <struts:form ... onSubmit="xxx"/> and <struts:submit ... onClick="xxx"/>.

>
> BTW
> Can a form property be somehting other than a string??
> Rob

At the moment it cannot.  On the client side, I don't see a lot of room for
changing this.  However, what I'm interested in exploring is the idea of adding
a "validate" attribute on the input fields like "text" that would generate
JavaScript code to validate things like "this field is required" and "this
field must be a date".  On the server end, though, the parameter values are
still going to come in as strings because of the way that the HTTP protocol
(and the servlet API) are defined.

Craig