Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/11/2013, 05:23
helenp
 
Fecha de Ingreso: mayo-2009
Mensajes: 382
Antigüedad: 15 años
Puntos: 6
dos form actions en función y pasar solo algunas variables por get

Hola,
tengo un formulario que tiene dos form actions dependiendo de una selección en radiobuttons.
Esta es la función:
Código Javascript:
Ver original
  1. function OnSubmitForm()
  2. {
  3. if(document.searcherform.a[0].checked == true)
  4.  {
  5.  document.searcherform.action="http://www.mysite.com/search.php
  6. }
  7. else
  8.  if(document.searcherform.a[1].checked == true)
  9. {
  10. document.searcherform.action="http://www.mysite.com/sales/search.php
  11.  }
  12.  return true;
  13.  }
Y este es el elemento form:
<form name="searcherform" method="get" onsubmit="return OnSubmitForm();">

Problema,
tambien tengo una función que según los mismos radiobuttons muestra distintos inputs.
Tambien funciona bien, pero a la hora de hacer el submit se pasan las variables a la pagina php, y no se pasan solo las variables seleccionadas en la función, sino todas las variables.:
Código Javascript:
Ver original
  1. function toggle(elemento) {
  2.               if(elemento.value=="1") {
  3.                   document.getElementById("uno").style.display = "block";
  4.                    document.getElementById("uno2").style.display = "block";
  5.                     document.getElementById("uno3").style.display = "block";
  6.                      document.getElementById("uno4").style.display = "block";
  7.                   document.getElementById("dos").style.display = "none";
  8.                   document.getElementById("dos2").style.display = "none";
  9.                   document.getElementById("dos3").style.display = "none";
  10.                }
  11.                else{
  12.                    if(elemento.value=="2"){
  13.                        document.getElementById("uno").style.display = "none";
  14.                         document.getElementById("uno2").style.display = "none";
  15.                          document.getElementById("uno3").style.display = "none";
  16.                           document.getElementById("uno4").style.display = "none";
  17.                        document.getElementById("dos").style.display = "block";
  18.                        document.getElementById("dos2").style.display = "block";
  19.                        document.getElementById("dos3").style.display = "block";
  20.                    }
  21.                 }
  22.                  }


Como puedo elegir que varibales pasar según el botón seleccionado?