You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Rea, Ron" <re...@coramhc.com> on 2002/10/08 23:55:04 UTC

Pop-up from with Nested loop

Has anyone ever used a pop-up form to fill data with a <nested:iterate>
section?
 
I am displaying several rows of data using a JSP and the <nested:iterate>
tag.  On each row, I want to create a link or button that, when clicked,
pops up a small page containing a textarea.  The user fills out the text
area, hits the close button, and that textarea  data is transferred back to
the parent form and placed in the correct property iteration within the
nested tag.  Any ideas???
 
Thanks.

Re: Pop-up from with Nested loop

Posted by Arron Bates <st...@keyboardmonkey.com>.
On Wed, 2002-10-09 at 07:55, Rea, Ron wrote:
> Has anyone ever used a pop-up form to fill data with a <nested:iterate>
> section?

Many times. Good for me, huh? :P

  
> I am displaying several rows of data using a JSP and the <nested:iterate>
> tag.  On each row, I want to create a link or button that, when clicked,
> pops up a small page containing a textarea.  The user fills out the text
> area, hits the close button, and that textarea  data is transferred back to
> the parent form and placed in the correct property iteration within the
> nested tag.  Any ideas???

It's quite easy without scripting & popups. With scripting it's a little
more clumsy.

The important parts you'll need is the nested property (the indexing,
mappings and whatever else) and it's value. These are quite easy to get
if you use a button or some type of input type.

With an onclick like... onClick="myFunc(this)"  ...on the button, and a
funciton like this...

function myFunc(ipt) {
  var url = "myfunkysite.com?"+ ipt.name +'='+ ipt.value
}

...you can see how it's going to be able to make a URL with the right
details of the nested element. The URL can then call an action and serve
your edit form.

As for updating the list, you'll have to take the form submit, submit it
to the server, and force the parent page to reload. On the parent page
this is easily done with...

document.location = document.location;


Then, of course you could drive the entire thing with script. Give the
table cells an ID, create the popup, draw the document into it, and
populate it with the content of the table cell. Update it, and replace
the table cell's content with the values from the form.
Some people may hate this solution as there's no Struts or Server
interaction at all and is 100% script dependent. But it'd work, work
well, and faster than any server call could ever be. It wouldn't work
for non DOM compliant browsers (but covers IE5+ NS6+ Moz1+ & Konq.
possibly more)

Hope that somewhere in all that is a little more light for your problem.


Arron.


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