I think I see the problem, it was with my example, it should have been:
var value = radioValue(document.formName.elements["apprEntry[0].primary_or_adjunct"]); where "formName" is the value of the name attribute of the form tag. (*Chris*) On 9/26/06, Uday Chandra Karrothi <[EMAIL PROTECTED]> wrote:
Thanks Chris, The request.getParameter works. I think i am going to go with that. the javascript was throwing soem errors. I will figure that out later. Thanks for the help once again. Later Uday Chandra On 9/26/06, Chris Pratt <[EMAIL PROTECTED]> wrote: > Wow, those are some ugly field names, but you should be able to access it > from either. In JavaScript I would probably use a helper function something > like: > > function radioValue (fld) { > for(var i = 0; i < fld.length;i++) { > if(fld[i].checked) { > return fld[i].value; > } > } > return fld[0].value; > } //radioValue > > Then you could access the value as: > > var value = radioValue(document.forms ["apprEntry[0].primary_or_adjunct"]); > > In Java you could just use: > > String value = request.getParameter("apprEntry[0].primary_or_adjunct"); > > (*Chris*) > > On 9/26/06, Uday Chandra Karrothi <[EMAIL PROTECTED]> wrote: > > > > Thanks Chris for the response. > > > > But here is the problem. > > <logic:iterate id="apprEntry" name="listDevApprGrpList" > > indexId="userIndex"> > > .. > > <html:radio value="A" name="apprEntry" property="primary_or_adjunct" > > indexed="true" onclick="">Pri.</html:radio> > > <html:radio value="B" name="apprEntry" property="primary_or_adjunct" > > indexed="true" onclick="">Adj.</html:radio> > > .. > > > > The resultant html code is > > ... > > <input type="radio" > > name="apprEntry[0].primary_or_adjunct" > > value="A" checked="checked" onclick="">Pri. > > <input type="radio" > > name="apprEntry[0].primary_or_adjunct" > > value="B" onclick="">Adj. > > ... > > > > <input type="radio" > > name="apprEntry[1].primary_or_adjunct" > > value="A" checked="checked" onclick="">Pri. > > <input type="radio" > > name="apprEntry[1].primary_or_adjunct" > > value="B" onclick="">Adj. > > ... > > > > You are right to say that the all the radio with the same name are > > considered in one group . > > > > Now how do i obtain the value or which radio button is checked. Can I > > access in Javascript or in the action class.? > > > > Please do let me know. Thank you for your response once again. > > > > Uday Karrothi > > > > On 9/26/06, Chris Pratt <[EMAIL PROTECTED]> wrote: > > > All the radio buttons (or checkboxes) with the same name are in a > > "button > > > group". The value of the selected radio button (or list of selected > > > checkboxes) is returned from request.getParameter() (or > > > request.getParameterValues()). > > > (*Chris*) > > > > > > On 9/26/06, Uday Chandra Karrothi <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi there, > > > > > > > > I have a problem. I am using groups of radio buttons. > > > > > > > > > > > > > > > > <logic:iterate id="apprEntry" name="listDevApprGrpList" > > > > indexId="userIndex"> > > > > > > > > .. > > > > > > > > <html:radio value="A" name="apprEntry" property="primary_or_adjunct" > > > > indexed="true" onclick="">Pri.</html:radio> > > > > > > > > <html:radio value="B" name="apprEntry" property="primary_or_adjunct" > > > > indexed="true" onclick="">Adj.</html:radio> > > > > > > > > .. > > > > > > > > > > > > How can get the value of the selected radio buttons in the action > > > > form. Is there something > > > > like a multibox for a radio group? > > > > if it is just one radio button group, i can get it from the property > > > > of the form bean. But when i there are multiple radio button groups, > > > > then how do i get the value of each of the button groups. > > > > > > > > > > > > I already spent a day of my time on this. Please advice me on this. > > > > Please direct me to the right resource > > > > > > > > Thank you, > > > > Uday Karrothi > > > > > > > > -- > > > > Never explain--your friends do not need it and your enemies will not > > > > believe you anyway--Elbert Hubbard > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > -- > > Never explain--your friends do not need it and your enemies will not > > believe you anyway--Elbert Hubbard > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- Never explain--your friends do not need it and your enemies will not believe you anyway--Elbert Hubbard --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]