Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Can't get value out of Struts nested radio buttons

843838Dec 19 2006 — edited Dec 19 2006
Hi,

I have a problem with the Struts nested radio buttons. I can't get the value out of the radio buttons.

The code is similar to the following. I don't have the access to the original code right now, but the logic is the same.
<html:html>

<script language="javascript">
    function submitForm(){
       alert( document.form.option.value );
   }
</script >

<body>
<nested:form action="/formAction" name="form">

<nested:radio property="option" value="AAA"/> Some label A
<nested:radio property="option" value="BBB"/> Some label B
<nested:radio property="option" value="CCC"/> Some label C

<nested:submit property="submit" value="Submit" onclick="submitForm();"/>

</nested:form>
</body>

</html:html>
I have defined the "option" property in the form. The problem is that, when I click on the Submit button, the javascript alert always shows "undefined". It does not retrieve the radio button's values such as AAA, BBB or CCC. I do not want to define the radio buttons in an iterative way.

Could anyone help to point out where the problem is? How can I retrieve the value when a radio button is selected? Sorry I couldn't find a solution, because most of the posts are talking about iteration with radio buttons.

Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 16 2007
Added on Dec 19 2006
7 comments
262 views