indexed tags (was - How can I pass extra information on Submit button?)

2001-06-26 Thread Laine Donlan

Dave -

I have been off the list for a while so I missed your original post.
Any idea if these indexed tags might make it into the formal releases?
We are beginning the process of transisitioning to the final 1.0 release
but would wait for an early 1.1 release if this would be included.

One other valuable thing I would think that might be useful to add to
the indexing would be some sort of property depth attribute.  In many
cases our form classes are merely wrappers for value objects (which in
some cases have their own arrays of value objects) so our form
properties may end of looking something like:
html:text name=someForm
property=valueObject.valueArray[0].name/
html:text name=someForm
property=valueObject.valueArray[0].phone/

Thanks

Laine
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 25, 2001 4:10 PM
To: [EMAIL PROTECTED]
Subject: Re: How can I pass extra information on Submit button?




As already posted to the list, I have been working to change most of the
tags to
generate indexed names within an iterate loop, for just this kind of
situation.

I have just changed the code for submit, so that the index of your
iterated
collection is added to the name ie name=submit[0] etc.  In your action
you can
then check which button was pressed, and display details for this
record.
Avoids javascript!

I am attaching an updated zip file to include this.  When I get some
time, I
will post all this to the dev list, to see about getting it added to
Struts.

Instructions as per previous posting:


Instructions for use:
- unpack attached zip file (this mailing list only accepts messages 
100K!!)
and copy .java files to ../org/apache/struts/taglib/html/
- rebuild struts
- add the struts-html.tld to your WEB-INF directory
- within an iterate tag, simply add indexed=true to the tag you wish
to use.
Eg to produce the text tag

  input type=text name=parameter[0].value value=Mac

use:
  logic:iterate id=parameter name=ParametersForm
property=parameterList
  ...
html:text name=parameter property=value
indexed=true/
  ...
  /logic:iterate

[in this case, simply do:  html:submit indexed=true

Hope this helps,

Dave

(See attached file: struts indexed files.ZIP)





Peter Alfors [EMAIL PROTECTED] on
06/25/2001
03:39:28 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: How can I pass extra information on Submit button?




You could place the id in the name of the submit button...  Then the
action
could parse the name of the submit button that was pressed for the
id
There must be a better method than this... But I have not come across
this
before, and that is what popped in my head.

Or.. If you can use javascript, you can set the form action (with the
id) and
submit the form with a simple javascript call.
However, you must be able to gaurentee that all users will have
javascript
enabled.
We do this... (But we are able to force our users to enable javascript)

Pete


Jerzy Kalat wrote:

 Yes, you can see it already in my piece of code, the first td

 - Original Message -
 From: Peter Alfors [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 25, 2001 3:24 PM
 Subject: Re: How can I pass extra information on Submit button?

  Are you going to place a button next to each record in the list?
 
 
  Jerzy Kalat wrote:
 
   Thanks,
  
   Well, I know about this solution, but they insist on button.
  
   - Original Message -
   From: Peter Alfors [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, June 25, 2001 3:18 PM
   Subject: Re: How can I pass extra information on Submit button?
  
You could use a link rather than the submit button.
Then when you iterate through your result-set, you just add the
'id'
 to
the link.
   
Pete
   
   
Jerzy Kalat wrote:
   
 Hi, I list many records on the form. Each record has 'Details'
 submit
 button, which suppose to flip form from 'List'mode to
'Details'
 mode,
 where only 1 record is visible with all it fields. On my jsp
page I
 have:  logic:iterate id=element
type=myApp.common.GeoEntity
 name=%= Constants.GEO_ENTITY_LIST %
  table
 tr
 td
 html:submit property=action value= Details   %!
WHAT
 SHOULD I PUT HERE TO PASS PROPERTY 'id' into FORM BEAN
'position'?
 %/html:submit
 /td
   tdbean:write name=element property=id//td
   tdbean:write name=element
property=name//td
 /tr
  /table
 /logic:iterate  I tried different things here but it does
not
 work,
 or produce error. Any hints how to do it, or is there better
way to
 approach it? Thanks in advance, JK
   
 




Re: indexed tags (was - How can I pass extra information on Submit button?)

2001-06-26 Thread dhay



Hi Laine,

Yep, I am hoping that it will be included in the formal releases.  Hopefully
tomorrow or Thursday I will post it all to the -dev list to see about this.
Hopefully that will mean it will be in a daily build soon.  Not sure when 1.1
will start being released.  The code I have posted is very easy to add to
existing Struts as it makes changes to the existing tags, rather than
introducing some new ones.

I'll check in to the property depth stuff too.

Cheers,

Dave




Laine Donlan [EMAIL PROTECTED] on 06/26/2001 09:55:53
AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  indexed tags (was - How can I pass extra information on Submit
  button?)



Dave -

I have been off the list for a while so I missed your original post.
Any idea if these indexed tags might make it into the formal releases?
We are beginning the process of transisitioning to the final 1.0 release
but would wait for an early 1.1 release if this would be included.

One other valuable thing I would think that might be useful to add to
the indexing would be some sort of property depth attribute.  In many
cases our form classes are merely wrappers for value objects (which in
some cases have their own arrays of value objects) so our form
properties may end of looking something like:
 html:text name=someForm
property=valueObject.valueArray[0].name/
 html:text name=someForm
property=valueObject.valueArray[0].phone/

Thanks

Laine
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 25, 2001 4:10 PM
To: [EMAIL PROTECTED]
Subject: Re: How can I pass extra information on Submit button?




As already posted to the list, I have been working to change most of the
tags to
generate indexed names within an iterate loop, for just this kind of
situation.

I have just changed the code for submit, so that the index of your
iterated
collection is added to the name ie name=submit[0] etc.  In your action
you can
then check which button was pressed, and display details for this
record.
Avoids javascript!

I am attaching an updated zip file to include this.  When I get some
time, I
will post all this to the dev list, to see about getting it added to
Struts.

Instructions as per previous posting:


Instructions for use:
- unpack attached zip file (this mailing list only accepts messages 
100K!!)
and copy .java files to ../org/apache/struts/taglib/html/
- rebuild struts
- add the struts-html.tld to your WEB-INF directory
- within an iterate tag, simply add indexed=true to the tag you wish
to use.
Eg to produce the text tag

  input type=text name=parameter[0].value value=Mac

use:
  logic:iterate id=parameter name=ParametersForm
property=parameterList
  ...
html:text name=parameter property=value
indexed=true/
  ...
  /logic:iterate

[in this case, simply do:  html:submit indexed=true

Hope this helps,

Dave

(See attached file: struts indexed files.ZIP)





Peter Alfors [EMAIL PROTECTED] on
06/25/2001
03:39:28 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: How can I pass extra information on Submit button?




You could place the id in the name of the submit button...  Then the
action
could parse the name of the submit button that was pressed for the
id
There must be a better method than this... But I have not come across
this
before, and that is what popped in my head.

Or.. If you can use javascript, you can set the form action (with the
id) and
submit the form with a simple javascript call.
However, you must be able to gaurentee that all users will have
javascript
enabled.
We do this... (But we are able to force our users to enable javascript)

Pete


Jerzy Kalat wrote:

 Yes, you can see it already in my piece of code, the first td

 - Original Message -
 From: Peter Alfors [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, June 25, 2001 3:24 PM
 Subject: Re: How can I pass extra information on Submit button?

  Are you going to place a button next to each record in the list?
 
 
  Jerzy Kalat wrote:
 
   Thanks,
  
   Well, I know about this solution, but they insist on button.
  
   - Original Message -
   From: Peter Alfors [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, June 25, 2001 3:18 PM
   Subject: Re: How can I pass extra information on Submit button?
  
You could use a link rather than the submit button.
Then when you iterate through your result-set, you just add the
'id'
 to
the link.
   
Pete
   
   
Jerzy Kalat wrote:
   
 Hi, I list many records on the form. Each record has 'Details'
 submit
 button, which suppose to flip form from 'List'mode to
'Details'
 mode,
 where only 1 record is visible with all it fields. On my jsp
page I
 have:  logic:iterate id=element
type=myApp.common.GeoEntity
 name=%= Constants.GEO_ENTITY_LIST %
  table