Since the nested classes constrain you to use the dot syntax, then you may
consider using an index notation on the scripting side, e.g.,

    document.managerForm[0].value = user;

assuming, of course, that "manager.lanID" is the first element on your
managerForm.

If you're concerned that the order of the fields on your screen may change
over time, then you may also try something like:

    document.managerForm['manager.lanID'].value = user;

Hth




                                                                           
             [EMAIL PROTECTED]                                             
             t                                                             
                                                                        To 
             06/02/2005 10:19          user@struts.apache.org              
             AM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         FormBean and JavaScript             
               "Struts Users                                               
               Mailing List"                                               
             <[EMAIL PROTECTED]                                             
                  he.org>                                                  
                                                                           
                                                                           




Hi,

I have got a problem with a Struts Form

My ActionForm has two attributes User and Manager (both are classes);
I am setting the  manager attributes on the form via the
<html:text property=”manager.lanID” />

Until here everything works as we would expect.

The problems comes in here;
When the JSP /Form gets rendered on the screen I am running the following
JavaScript.

=================================================
function getUser()
{
    var wshNetwork = new ActiveXObject("WScript.Network");
    var user = wshNetwork.username;
    document.managerForm.manager.lanID.value = user;


}

=======================================================
in the JSP this function is then called.
I am using this JavaScript to pre populate the lanID attribute of Manager
class.

It works if the field is managerLanID but when I use the dot syntax
Javascipt gets confused and the browser pops an error message which says an
object is expected.

Since I use nested classes on my ActionForm I need to use the dot syntax,
but this stops the JavaScript to assign the value to my html text field.

Any feedback is welcome.

Thanks in advance


Karim




__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at
http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to