Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5989767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:08:54+00:00 2026-05-22T23:08:54+00:00

I need to set ‘s:textarea’ value which is selected in ‘s:radio’ button. I am

  • 0

I need to set ‘s:textarea’ value which is selected in ‘s:radio’ button.

I am currently using the code below to do it. But it always set the ‘In test’ value in ‘s:textarea’ which is the first value in ‘s:radio’ button list.

function handleCommentChange()
{
    var comment = document.getElementById('comment');

    var radioComment1 = document.getElementById('radio1');

    comment.value = radioComment1.value;

}


<td>
  <s:radio id="radio1" name="radio1" list="#{'In test':'In test','Defect':'Defect','Pass':'Pass', 'Fail':'Fail' }"
     onclick="javascript:handleCommentChange();" ></s:radio>
  <br></td>

<td><s:textarea id="comment" name="comment" cols="25" rows="5"></s:textarea></td>

Please tell how I can set the selected value of ‘s:radio’ button in ‘s:textarea’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:08:55+00:00Added an answer on May 22, 2026 at 11:08 pm

    Pass a reference to the clicked radio in to your handleCommentChange() function. You can pass this, which will give the function a reference to the radio element and let you access all of its properties, etc., or you can pass this.value directly and have the function assign that string to your textarea. I prefer to pass this to allow for future expansion needing access to other properties:

    function handleCommentChange(aRadio) {
       document.getElementById('comment').value = aRadio.value;
    }
    
    
    <s:radio ... onclick="handleCommentChange(this);">
    

    The other way to do it is to setup a loop to go through each radio button and check which one has its checked property set to true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to set a dependency property on a control (Slider.Value) in my code
Need to set left margin to a button object programatically. This is the code
I use h:selectOneRadio tag. I need to set the cursor focus to first radio
I need set the date/time from Android programmatically, but I'm not having success! I
I need to set the cmd hidden text to the values below. Chrome executes
Usually, we can set this value as a text, while what I need is
I need to set a max year on the DatePickerDialog that I am using
i need to set the defult value for a ListPreference when the Activity starts.
Ok I have ten variables but one needs to be set, but I need
I need set field value, not passed to Django Form constructor. I have model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.