You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jo...@mizuhocbus.com on 2003/05/28 20:34:56 UTC

javascript nested:iterate property reference

I'm trying to use Matt Kruse's javascript calendar popup 
(http://www.mattkruse.com/javascript/calendarpopup/) inside a 
nested:iterate. This is likely a javascript question, but I would 
appreciate any help.... and it may help others save looking through the 
archives for the 8+ hours I've spent already trying to find this.

The call to "cal1" on the "onselect" fails. I've tried every permutation I 
could think of. I've tried putting the document element reference in a 
variable and calling it that way, but it seems the tmpIndex will not 
resolve. This would seem to be a generalized problem for referencing any 
form property in a javascript function call involving nested:iterate 
elements. Once again, please, any help vastly appreciated.

Here is the jsp excerpt:
<<<<<
<nested:iterate property="eventList" id="ev" indexId="evIdx">
        <table width="924" border="4" cellpadding="0" cellspacing="0">
         <bean:define id="tmpIndex" value="<%= 
String.valueOf(evIdx.intValue())%>"/> 
                <td><font size="-1" face="Arial, Helvetica, sans-serif">
                        <script language='JavaScript'>var cal1 = new 
CalendarPopup();
                        cal1.setReturnFunction('showDate0');
                        cal1.offsetX=2;
                        function showDate0(y,m,d)
                        {document.forms[0].elements['targetDate'].value = 
m + "-" + d + "-" + y;}
                        myVar2 = "document.forms[0].targetDate [" + 
tmpIndex + "]";
                        </script>
                <nested:text property="targetDate" />  </font> 
                <a HREF="#" 
onClick="cal1.select(document.forms[0].targetDate[tmpIndex],'anchor1','MM/dd/yyyy'); 
return false;" NAME="anchor1" ID="anchor1">
                <img src="image/cal.gif" width="18" height="18" 
border="0"> (m-d-yyyy)
                </a>
                </td>
                ......
>>>>>



= = = = = = = = = == = = = = = == = = = = = = = == = = = = = == = = = = 
This transmittal and any attachments may contain confidential, privileged or sensitive information and is solely for the use of the intended recipient. If you are not intended recipient, you are hereby notified that you have received this transmittal and any such attachments in error and any review, dissemination, distribution or copying thereof is strictly prohibited. If you have received this transmittal and any attachments in error please notify the sender and immediately destroy the message and all its attachments. Any opinions herein expressed may be those of the author and not necessarily of Mizuho Corporate Bank, Ltd (the "Bank"). The Bank accepts no responsibility for the accuracy or completeness of any information herein contained.
= = = = = = = = = == = = = = = == = = = = = = = == = = = = = == = = = =