You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tony Smith <qu...@yahoo.com> on 2006/02/08 06:05:03 UTC

get element by long name

in my jsp, there is something like:

<html:text property="plateDetail.name"
value="${plateDetailEditForm.plateDetail.name}"  />


How can I get this element in javascript? the
following code does not work:

var name =
document.getElementByName("plateDetail.name").value;

I think it is because there is a '.' in the name.

Any idea?

Thanks,

qq


	

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: get element by long name

Posted by David Smith <dn...@cornell.edu>.
I think there is some confusion regarding server-side execution versus 
client-side execution. code like ${plateDetailEditForm.plateDetail.name} 
is entirely server-side as is the plateDetailEditForm object. You are 
trying to access that directly from the client which can't be done. You 
can try this solution and it will work for individual values:

 var name="${plateDetailEditForm.plateDetail.name} "

Tomcat will replace the ${...} expression with the value as the page is 
sent to the client. JavaScript on the client will get var name="name value".

-- David

Tony Smith wrote:
> in my jsp, there is something like:
>
> <html:text property="plateDetail.name"
> value="${plateDetailEditForm.plateDetail.name}"  />
>
>
> How can I get this element in javascript? the
> following code does not work:
>
> var name =
> document.getElementByName("plateDetail.name").value;
>
> I think it is because there is a '.' in the name.
>
> Any idea?
>
> Thanks,
>
> qq
>
>
> 	
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: get element by long name

Posted by Nikola Milutinovic <al...@yahoo.com>.
--- Tony Smith <qu...@yahoo.com> wrote:

> in my jsp, there is something like:
> 
> <html:text property="plateDetail.name"
> value="${plateDetailEditForm.plateDetail.name}"  />
> 
> 
> How can I get this element in javascript? the
> following code does not work:
> 
> var name =
> document.getElementByName("plateDetail.name").value;
> 
> I think it is because there is a '.' in the name.
> 
> Any idea?

Get Element By Name goes for the HTML name, like "h1",
"body", etc. For CSS and JavaScript access, you can
use element ID, like this:

<html:text property="plateDetail.name"
 value="${plateDetailEditForm.plateDetail.name}"
 styleId="plateDetailName" />

<script type="text/javascript">
<!--
    name = getElementById( "plateDetailName" );
    alert( name.value );
//-->
</script>

Nix.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org