You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Susan Bradeen <Su...@softlanding.com> on 2002/11/18 15:05:31 UTC
Re: Simulating Client field prompting -- follow up
Following up with my solution, in case others have a similar question, and
thanks again to those who offered ideas. I ended up using a separate
selection window, and compromised on some JavaScript usage. Struts actions
open the new window and populate the selection list. JavaScript is used
only to pass the field values back to the original form and "auto" close
the selection window. Without access to JavaScript, one could still look
up the desired information, but must manually type in the field values on
the form and close the selection window.
In my form JSP, I open the selector (JSP) window using a link next to each
field:
<snip>
<html:link page="/promptselector.do?field=person" target="_blank">Select Person</html:link>
</snip>
In my selector JSP:
<snip>
<script language="JavaScript">
function promptPerson(id, first, last) {
window.opener.document.forms[0].person.value = id;
window.opener.document.forms[0].personName.value = first+" "+last;
self.close();
}
</script>
</snip>
<snip>
<logic:iterate name="promptform" property="persons" id="person">
<tr align="left">
<td><bean:write name="person" property="personID"/></td>
<td><bean:write name="person" property="firstName"/></td>
<td><bean:write name="person" property="lastName"/></td>
<td><a href="javascript:promptPerson(
'<bean:write name="person" property="personID"/>',
'<bean:write name="person" property="firstName"/>',
'<bean:write name="person" property="lastName"/>')" >Select</a>
</td>
</tr>
</logic:iterate>
</snip>
Susan Bradeen
On 11/12/2002 02:23:10 PM "Susan Bradeen" wrote:
> I have a few fields in some JSPs that will need to provide
"client/server
> type field prompting" (user double-clicks on a field to open a selection
> window). In reviewing the Struts docs and archives, it appears that
there
> is no "Struts-specific" functionality for this, and I noticed that other
> people have used JavaScript pop-up windows in similar situations.
Although
> I've used pop-ups before, I am not confident they *will* be
cross-browser
> compatible, which is important in this application, so I am shying away
> from using them this time. Unfortunately, I cannot use Struts
> selection/drop boxes for these fields, since my list of selections is
> quite large (user name lists, etc).
>
> I am wondering ... has anyone has come up with a different (less
> JavaScript) approach to making a field value selection from another
list?
>
> Thanks for any ideas,
> Susan Bradeen
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>