You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Janardhan, Shandrila" <sj...@indcon.com> on 2002/02/01 01:47:58 UTC

Mapped Properties and JavaScript

Hello

I am using mapping properties in my jsp. I am unable to refer these mapped
property in the 
javascript. For instance :

I have the following select tag in the jsp and the selection made is mapped
to a bean
named 'product'  with an accessor threeDigitCode. I have a button (an image)
which has
a href to a javascript, which checks if a value has been selected in the
options. 

I am using document.frmCustomer.product.threeDigitCode.selectedIndex 
to refer to the element name in the javascript, but javascript error says 
"element not found"

How do I get over this. Could someone give me a suggestion.


<html:select property="product.threeDigitCode"  style="font-size:8"
multiple="Y">
                <html:option value="0"> Please Select One Or More Products
</html:option>
                <html:option value="1">ABRASIVES</html:option>
                <html:option value="1">COMPRESSORS</html:option>
                <html:option value="3">ARTOBJECTS </html:option>
</html:select>
<a href="javascript:openWidgetWindow();" target="_self"><html:img
src="5digit.gif" border="0" align="center"/></a>
            
I have a javascript function as follows:
function openWidgetWindow(){
if ((document.frmCustomer.product.threeDigitCode.selectedIndex == 0) ||
(document.frmCustomer.product.threeDigitCode.selectedIndex == -1))
{
alert("- Please choose a Product to view the Pop Up Screen");
}
else
{
window.open("popup.html","lookup","scrollbars=no,titlebar=no,width=530,heigh
t=230,top=197,left=150");
}
Thanks
Shandrila

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