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 181723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:48:51+00:00 2026-05-11T14:48:51+00:00

I have a few radiobuttons in a jsp page. I run a javascript method

  • 0

I have a few radiobuttons in a jsp page. I run a javascript method once the page is loaded that seeks for certain radio buttons and change its name so they work like a radio group.

I’m doing it this way because the radio buttons are inside jsf table and I have no access to the name property when coding and I want all of the radio buttons work like a radio group.

Anyways the script run without problems and the radio buttons’ names are changed properly.

But while this works in FF 3 (the work like a radio group) it doesn’t work in IE 6 or IE7 though they have the same ‘name’ property. Does anyone know how can I solve this?

function setRadioGroup (nombreRadio){     var listaRadios = document.getElementsByTagName('input');     var tam = listaRadios.length;     for (i = 0; i < tam; i++){         if (listaRadios[i].type == 'radio' && listaRadios[i].title == 'Seleccionar'){         listaRadios[i].name = nombreRadio;        }     } } 

EDIT: Added the code output of the webpage:

<form id='formulario' name='formulario' method='post'     action='/serequp/faces/administracion/articulosPv.jspx'><input     type='hidden' id='formulario:hidRegTablaArticulos'     name='formulario:hidRegTablaArticulos' value=''> <div class='dr-pnl rich-panel ' id='formulario:ContFormularios'> <div class='dr-pnl-h rich-panel-header cabeceraFormulario'     id='formulario:ContFormularios_header'>LISTADO DE GRUPOS DE EQUIPAMIENTOS</div> <div class='dr-pnl-b rich-panel-body cuerpoFormularios'     id='formulario:ContFormularios_body'> <table id='formulario:botones'>     <tbody>         <tr>             <td class='estiloColumnas'><input id='formulario:j_id66'                 name='formulario:j_id66'                 onclick='A4J.AJAX.Submit('_viewRoot','formulario',event,{'parameters':{'formulario:j_id66':'formulario:j_id66'} ,'actionUrl':'/serequp/faces/administracion/articulosPv.jspx','similarityGroupingId':'formulario:j_id66'} );return false;'                 value='Crear' type='button'></td>             <td class='estiloColumnas'><input id='formulario:j_id67'                 name='formulario:j_id67'                 onclick='A4J.AJAX.Submit('_viewRoot','formulario',event,{'parameters':{'formulario:j_id67':'formulario:j_id67'} ,'actionUrl':'/serequp/faces/administracion/articulosPv.jspx','similarityGroupingId':'formulario:j_id67'} );return false;'                 value='Modificar' type='button'></td>             <td class='estiloColumnas'><input id='formulario:j_id68'                 name='formulario:j_id68'                 onclick='A4J.AJAX.Submit('_viewRoot','formulario',event,{'parameters':{'formulario:j_id68':'formulario:j_id68'} ,'actionUrl':'/serequp/faces/administracion/articulosPv.jspx','similarityGroupingId':'formulario:j_id68'} );return false;'                 value='Borrar' type='button'></td>             <td></td>         </tr>     </tbody> </table> <table class='dr-table rich-table ' id='formulario:tablaArticulos'     border='0' cellpadding='0' cellspacing='0'>     <colgroup span='3'></colgroup>     <thead class='dr-table-thead'>         <tr class='dr-table-subheader rich-table-subheader '>             <th class='dr-table-subheadercell rich-table-subheadercell  '                 scope='col' id='formulario:tablaArticulos:j_id69header'>             <div id='formulario:tablaArticulos:j_id69header:sortDiv'>Nombre</div>             </th>             <th class='dr-table-subheadercell rich-table-subheadercell  '                 scope='col' id='formulario:tablaArticulos:j_id71header'>             <div id='formulario:tablaArticulos:j_id71header:sortDiv'>Nombre</div>             </th>             <th class='dr-table-subheadercell rich-table-subheadercell  '                 scope='col' id='formulario:tablaArticulos:j_id75header'>             <div id='formulario:tablaArticulos:j_id75header:sortDiv'>Descripci&oacute;n</div>             </th>         </tr>     </thead>     <tbody id='formulario:tablaArticulos:tb'>         <tr class='dr-table-firstrow rich-table-firstrow '>             <td class='dr-table-cell rich-table-cell center '                 id='formulario:tablaArticulos:0:j_id69'>             <table id='formulario:tablaArticulos:0:radioGroup1'>                 <tr>                     <td><input id='formulario:tablaArticulos:0:radioGroup1:0'                         type='radio' name='formulario:tablaArticulos:0:radioGroup1'                         value='1' onclick='updateSelected('hidRegTablaArticulos', '1');'                         title='Seleccionar'><label                         for='formulario:tablaArticulos:0:radioGroup1:0'></label></td>                 </tr>             </table>             </td>             <td class='dr-table-cell rich-table-cell center '                 id='formulario:tablaArticulos:0:j_id71'>fff</td>             <td class='dr-table-cell rich-table-cell center '                 id='formulario:tablaArticulos:0:j_id75'>PRUEBA SDS</td>         </tr>         <tr class='dr-table-firstrow rich-table-firstrow '>             <td class='dr-table-cell rich-table-cell center '                 id='formulario:tablaArticulos:1:j_id69'>             <table id='formulario:tablaArticulos:1:radioGroup1'>                 <tr>                     <td><input id='formulario:tablaArticulos:1:radioGroup1:0'                         type='radio' name='formulario:tablaArticulos:1:radioGroup1'                         value='1' onclick='updateSelected('hidRegTablaArticulos', '2');'                         title='Seleccionar'><label                         for='formulario:tablaArticulos:1:radioGroup1:0'></label></td>                 </tr>             </table>             </td>             <td class='dr-table-cell rich-table-cell center '                 id='formulario:tablaArticulos:1:j_id71'>dd</td>             <td class='dr-table-cell rich-table-cell center '                 id='formulario:tablaArticulos:1:j_id75'>PRUEBA SDS</td>         </tr>     </tbody> </table> <script>                             setRadioGroup('radioGroup1');                         </script></div> </div> <table id='formulario:botonera'>     <tbody>         <tr>             <td><input id='formulario:j_id80' name='formulario:j_id80'                 onclick='A4J.AJAX.Submit('_viewRoot','formulario',event,{'parameters':{'formulario:j_id80':'formulario:j_id80'} ,'actionUrl':'/serequp/faces/administracion/articulosPv.jspx','similarityGroupingId':'formulario:j_id80'} );return false;'                 value='Grabar' type='button'></td>         </tr>      </tbody> </table> <input type='hidden' name='formulario' value='formulario'><input     type='hidden' name='autoScroll' value=''><input type='hidden'     name='formulario:j_idcl' value=''><input type='hidden'     name='formulario:_link_hidden_' value=''><script     type='text/javascript'>function clear_formulario() { _clearJSFFormParameters('formulario','',['formulario:j_idcl','formulario:_link_hidden_']); } function clearFormHiddenParams_formulario(){clear_formulario();} function clearFormHiddenParams_formulario(){clear_formulario();} clear_formulario();</script><input type='hidden' name='javax.faces.ViewState'     value='!40dc077b'></form>* 
  • 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. 2026-05-11T14:48:52+00:00Added an answer on May 11, 2026 at 2:48 pm

    I finally got the answer!

    The solution come from this blog, but with some modification (the blog, as many others, solve the problem for create a new element, not to modify an existant one).

    The problem is that Internet Explorer does not allow some attributes modification during the run time. One of these is the attribute name. As it can not be modified, the behaviour is not what you’re expecting. The solution is to create a new element, remove the old one and replace it by the new one.

    Here the solution (work with Firefox 3 and IE 7):

    <script> function setRadioGroup (name){   var listaRadios = document.getElementsByTagName('input');   var tam = listaRadios.length;   for (i = 0; i < tam; i++){     cur = listaRadios[i];     if (cur.type == 'radio' ){       try {       // if not IE, raise an error and go to catch.                       element = document.createElement('<input onclick='alert(this.name + this.value);' type='radio' name='' + name + '' value='' + cur.value + ''>');           parentNode = cur.parentNode;           parentNode.insertBefore(element, cur);           parentNode.removeChild(cur);         } catch (err ) {           cur.setAttribute('name', name);           cur.setAttribute('onclick', 'alert(this.name + this.value);');         }      }   } } </script>  <html>   <head>     <title>My Page</title>   </head>   <body onload='setRadioGroup('test')'>     <form name='myform' action='http://www.mydomain.com/myformhandler.cgi' method='POST'>       <div align='center'><br>         <input type='radio' value='Milk'> Milk<br>         <input type='radio' value='Butter' > Butter<br>         <input type='radio' value='Cheese'> Cheese         <hr>         <input type='radio' value='Water'> Water<br>         <input type='radio' value='Beer'> Beer<br>         <input type='radio' value='Wine' > Wine<br>       </div>     </form>   </body> </html> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 167k
  • Answers 167k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You're not using dynamic sql correctly - you have to… May 12, 2026 at 1:34 pm
  • Editorial Team
    Editorial Team added an answer As a rule of thumb, check the existing .NET framework… May 12, 2026 at 1:34 pm
  • Editorial Team
    Editorial Team added an answer Yes, but if you print that string out it will… May 12, 2026 at 1:34 pm

Related Questions

I've got a xaml TabControl and on one page, there are 3 RadioButtons each
I have a TemplateField in a DetailsView and its input should be one of
Trying to build a GUI application in Java/Swing. I'm mainly used to painting GUIs
With CSS I can set font and background colours for the individual options of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.