Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/04/2014, 21:46
Avatar de Briss
Briss
 
Fecha de Ingreso: junio-2011
Mensajes: 1.293
Antigüedad: 12 años, 9 meses
Puntos: 12
Respuesta: Funcion en form

Cita:
Iniciado por Triby Ver Mensaje
Muevo tu tema desde PHP a Javascript.

Por cierto, si usas la función init() al cargar la página y la función tipo() al seleccionar un elemento del radio, no es necesario incluir la parte del onsubmit, a menos que vayas a realizar otra acción.

Aparte, supongo que no funciona en el onsubmit porque no estás enviando el parámetro que require la función.
Gracias Triby lo deje asi pero nada
Código HTML:
<script type="text/javascript">
function init() {
    document.getElementById("select1").disabled = true;
}
function tipo(radio){
    document.getElementById("select1").disabled=(radio.value == 2)?true: false;
}
</script>
</head>
<body onload="init()">
<form action method="POST" name="formulario" id="formulario"  onsubmit="tipo(radio); ">
<table>
    <tr>
        <th>Tipo</th>
        <td>
            <input type="radio" name="tipo" value="1" onclick="tipo(this)" />Uno
            <input type="radio" name="tipo" value="2" checked onclick="tipo(this)" />Dos
        </td>
    </tr>
    <tr>
        <th>Tipo</th>
        <td>
            <select name="select1" id="select1">
            <option value="1">ABC</option>
            <option value="2">DFG</option>
            </select>
        </td>
    </tr>   
</table>
</form>