Hi,
 
I am able to display the text field for phoneNumber now. The code i wrote is 
 
<logic:iterate name="autoForm" property="menuEntries" id="menuEntries" indexId="idx">
             <tr>
             <td valign="middle">
             <bean:write name="menuEntries" property="key"/>
             <html:hidden name="menuEntries" property="key"/>
            </td>
             <td valign="middle">
             <html:text name="menuEntries" property="description" size="15" 
maxlength="15"/>
             </td>
             <td valign="top">
               <html:select name="menuEntries" property="menuAction" 
onchange='<%="showOrHidePhoneNumber(this.value, "+idx+");"%>'>
                <html:option value="">Select A Action</html:option>
                 <html:options name="actionNames" labelName="actionNames"/>
                  </html:select>
                 </td>
                 <td>
                 <div id="<%=idx%>" style="{display:inline}">
                  <html:text property="phoneNumber" size="15" maxlength="15"/>
                  </div>
                 </td>
                <!-- </tr> -->
                 </logic:iterate>
 
 
function showOrHidePhoneNumber(actionselected,index) {
      alert(index);
      alert(actionselected);
      if(actionselected=="Transfer with prompt") {
        document.getElementById(index).style.display = "inline";
           } else {
            document.getElementById(index).style.display = "none";
         }
      }
 
 
I have to call showOrHidePhoneNumber(actionselected,index) when the page loads.
And it should not display the textfield for phoneNumber  for all 11rows as the default 
option is not "Transfer with prompt". Help me figure out this function.
 
Thanks,
Latha
 
 


Srilatha Salla <[EMAIL PROTECTED]> wrote:
Thanks for the help.

I tried to understand what was on the site, it might take some time.

If possible can you let me know how to implement it in my case.

I have MenuEntry[] menuentries. in my form. MenuEntries has properties key, 
description and menuaction.

So, what should i change this to.

Thanks.

Niall Pemberton wrote:
No you don't need 11 different methods, if you read through this it
(hopefully) should be clearer

http://struts.apache.org/faqs/indexedprops.html

Niall

----- Original Message ----- 
From: "Srilatha Salla" 
To: "Struts Users Mailing List" 
Sent: Friday, November 05, 2004 5:49 PM
Subject: Re: Hi


> Hi,
>
> i tried using indexed="true" for
>
> id="menuEntries">
> 
> 
> 
> indexed="true"/>
> 
> 
> size="15" maxlength="15" indexed="true"/>
> 
> 
> indexed="true">
> Select A Action
> labelName="actionNames"/>
> 
> 
> 
> maxlength="15"/>
> 
>
> I have a menuentry[] menuEntries property in formbean.
> so i need to index for description and key also.
> There is indexed attribute for html:text but not for bean:write
> So i used html:hidden indexed="true"
>
> I have get and set methods in menuEntry class for key, description and
menuaction.
> MenuEntry[] menuEntries = form.getMenuEntries(); in action class.
>
> tried retrieving the menuEntries[] in the action class.
> I get java.lang.NullPointerException
> at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.
java:515)
>
>
>
> so if I use indexed, should there be 11 different get and set methods
because name of the property changes name="menuEntries[5].menuAction">.
>
> Is there anyother way without using indexed, but send index of the
property to the onchange method.
>
> Thanks,
> Latha.
>
>
>
>
> Niall Pemberton wrote:
> Using indexed="true" will generate names such as menuAction[0],
> menuAction[1] etc...
>
> indexed="true">
>
> Niall
>
> ----- Original Message ----- 
> From: "Srilatha Salla"
> To:
> Sent: Friday, November 05, 2004 4:41 PM
> Subject: Hi
>
>
> > Hi,
> >
> > I have a logic:iterate tag in my jsp.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > size="15" maxlength="15"/>
> >
> >
> >
> > Select A Action
> > labelName="actionNames"/>
> >
> >
> >
> > I have 11 rows to iterate.
> > for each html:select i have to invoke onchange method such that
depending
> on the selection(for example if have options a,b,c,d in dropdownlist, i
have
> to display a textfield called phonenumber only for options a,c.). My
problem
> is i have to send some parameter in the onchange method, but since it is
> iteration every iteration has same propertyname,
> > I have "menuAction" as property name for htmlselect.
> >
> > I should be able to get the phonenumber only for the options i sent when
> i load the page.(Iike edit page)
> >
> > I would appreciate if anyone can help me.
> >
> > Thanks,
> > Latha
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Check out the new Yahoo! Front Page. www.yahoo.com/a



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


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

                        
---------------------------------
Do you Yahoo!?
 Check out the new Yahoo! Front Page.  www.yahoo.com/a

Reply via email to