struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: Is this possible?
Date Wed, 09 Oct 2002 02:21:24 GMT
Where are you defining the overrideExp variable in your javascript?
I can see that you have also named your field overrideExp, but where is the
variable overrideExp defined?
Or did you intend it as a string literal - ie: 'overrideExp'?

You could also use the elements array in the form to get the document if you
dont want to use getElementById()

ie:

onClick="opener.document.forms[0].elements[fieldName].value =
document.forms[0].elements[overrideExp].value; window.close;"

where fieldname is a variable with name of field in popup window, and
overrideExp is variable name of field in main window. (Or replace these
variables with string literals).

Not sure what the fieldname generated by nested tags is. Like Joe says, you
will likely want to check the generated html to see what it is so you can
use it in your script.

If the field is generated in an iterate tag, you might also want to see that
each field has a unique name - or if not - give each field a unique id
seperate from its name (thats the styleId attribute for struts tags) and use
getDocumentById() to find the element

-----Original Message-----
From: Joe Barefoot [mailto:Joe.Barefoot@motiva.com]
Sent: Wednesday, October 09, 2002 06:44
To: Struts Users Mailing List
Cc: rear@coramhc.com
Subject: RE: Is this possible?


Sorry, didn't see your post until now.  hmmmm...I think I goofed with using
the 'this' keyword, for starters.  It should be 'self'.  Actually, you can
probably omit it entirely.  If this isn't the cause of your error, I'm not
really sure what's going on...I'm no JavaScript expert myself.  ;)  You can
try referencing that field another way (not using getElementById).  The only
way I know of to print a JavaScript object to screen is to set one of your
form fields to it's value...not much help in this case I'm afraid...



onClick=opener.document.getElementById(fieldName).value =
self.document.getElementById(overrideExp).value; window.close


> -----Original Message-----
> From: Rea, Ron [mailto:rear@coramhc.com]
> Sent: Tuesday, October 08, 2002 10:28 AM
> To: 'Struts Users Mailing List'
> Subject: RE: Is this possible?
>
>
> Hi Joe,
>
> Thanks for reply.  I tried this, but I get an error when I
> enter the pop-up
> screen saying that "overrideExp" is not an object.  I'm pretty new to
> javascript, so I'm not sure how to expose the data entered in
> the pop-up,
> nor how to do a display within a javascript to see if the
> entered data is
> going into a variable properly.  Any thoughts?
>
> Thanks
> Ron
>
> -----Original Message-----
> From: Joe Barefoot [mailto:Joe.Barefoot@motiva.com]
> Sent: Monday, October 07, 2002 7:36 PM
> To: Struts Users Mailing List
> Subject: RE: Is this possible?
>
> From what I see, there's no logic in your popup to populate
> the form field
> (the Explanation) in your opening window.  You need to pass
> in the id of the
> explanation field so you can populate it when the popup is closed:
>
> Your function needs to accept a 'fieldName' argument and then
> do something
> like this when you hit the close button:
>
> onClick=opener.document.getElementById(fieldName).value =
> this.document.getElementById(overrideExp).value; window.close
>
>
> Since you're using the nested tags, you'll have to figure out
> what names it
> gives the fields in the generated HTML so you can pass those in to the
> JavaScript function.  I'm guessing it does something like:
> gridArray[i].overrideExp
>
>
> peace,
> Joe
>
>
>
> > -----Original Message-----
> > From: Rea, Ron [mailto:rear@coramhc.com]
> > Sent: Monday, October 07, 2002 4:46 PM
> > To: 'struts-user@jakarta.apache.org'
> > Subject: Is this possible?
> >
> >
> > Hello,
> > I'm not sure if this is possible from within a
> > <nested:iterate> tag, any
> > help would be greatly appreciated!
> >
> > From within my JSP, I am iterating through several rows of data and
> > displaying the data for modification.  One specific property is an
> > Explanation field.  What I'd like to do is create a "memo"
> > link on each row
> > of data, and when that link is hit, a small page is displayed
> > with only that
> > rows Explanation data.  The user enters up to 300 bytes of
> > data for their
> > Explanation, within the pop-up, and when they close the
> > pop-up, the specific
> > rows Explanation property is updated within the
> > <nested:iterate> section.
> >
> > I can create the pop-up, but after I enter the data, the rows
> > Explanation
> > property is not updated.  Any ideas?  Is this possible?
> >
> > Thanks!
> >
> > Example of code:
> >
> > JSP:
> >     <nested:iterate property="gridArray">
> >             <td><nested:write property="msgCode"
> > filter="true"/>&nbsp;</td>
> >             <td>
> >                         <nested:radio property="overrideInd"
> > value="A"/>Approve
> >                         <nested:radio property="overrideInd"
> > value="D"/>Deny
> >             </td>
> >             <td>
> >                         <nested:hidden property="overrideExp"/>
> > <a href="javascript:getText('Override Explanation',
> > 'opener.document.form.overrideExp.value', 'Please enter an Override
> > Explanation in the following text area.', '<nested:write
> > property="overrideExp" filter="true"/>' ,'<nested:write
> > property="msgCode"
> > filter="true"/>');" onMouseOver="window.status='Click to
> > enter an Override
> > Explanation...';return true;" onMouseOut="window.status='';return
> > true;">memo</a>
> >             </td>
> >   </tr>
> >   </nested:iterate>
> >
> > Javascript:
> > <SCRIPT LANGUAGE="JavaScript">
> > function getText(name, output, msg, dataValue, msgKey) {
> > newwin = window.open('','','top=150,left=150,width=325,height=330');
> > if (!newwin.opener) newwin.opener = self;
> > with (newwin.document)
> > {
> > open();
> > write('<html>');
> > write('<body onLoad="document.form.box.focus()"><form
> > name=form>' + msg +
> > '<br>');
> > write('<p><left>Message Code: <strong>' + msgKey + '</strong>');
> > write('<p><center><textarea name=overrideExp rows=10 cols=30
> > onKeyUp=' +
> > output + '=this.value>' + dataValue + '</textarea>');
> > write('<p><input type=button value="Click to close when finished"
> > onClick=window.close()>');
> > write('</center></form></body></html>');
> > close();
> >    }
> > }
> > </script>
> >
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>

--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message