Pass data from one input to another input (each input is different html)

0

I have an html which in an input allows me to enter a data to perform a search, I must be able to take that data entered in that input and put it in a popUp (new window).

Hmtl 1

<Doctype html>
    <head>
        <title>Contacto Coleccions</title>
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    </head>

<html>
    <body>

    <div id="menu">
        <a class="btn btn-default" href="#" role="button">Archivo</a>
        <a class="btn btn-default" href="#" role="button">Gestion</a>
        <a class="btn btn-default" href="#" role="button">Procesos</a>
        <a class="btn btn-default" href="#" role="button">Ayuda</a>
        <a class="btn btn-default" href="#" role="button">Informes</a>
        <a class="btn btn-default" href="FormGestion.html" target="_blank" onClick="window.open(this.href, this.target, 'width=300,height=500'); return false;" role="button">PopUp</a>
    </div>
        <br>

        <div class="table-responsive">
        <table class="table table-bordered">
            <tr>
              <td class="info">Usuario</td>
              <td class="info">Fecha_gestion</td>
              <td class="info">Telefono</td>
              <td class="info">Gestion</td>
              <td class="info">Concuencia</td>
              <td class="info">Motivo_de_No_Pago</td>
              <td class="info">Contacto</td>
              <td class="info">Proxima_Gestion</td>
              <td class="info">Observacion</td>
            </tr>
        </table>
        </div>
        <br>
        <br>
        <br>

        <h1 class="text-center">MOVISTAR<small>_PYMES</small></h1>

        <div id="buscar">
        <form class="form-inline">
        <div class="form-group">
        **<input class="form-control" id="inputPassword" placeholder="Identifiacion"> <!--Este es el input que captura la informacion -->**
        </div>

         <button type="submit" class="btn btn-default">Buscar</button>
        </form>
        </div>
    </body>
</html>

html 2 (popUp)

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Form Gestion</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  </head>
  <body>
    <h3>Ejemplo de formulario para diligenciar la gestion</h3>
    <label class="" for="">Identificacion</label>
    <input class="form-control" type="text" name="" value=""> **<!--Este input es el que debe recibir el valor del otro input-->**
    <select class="form-control" name="">
      <option>Seleccione la consecuencia</option>
      <option value="">Tipificacion #1 </option>
      <option value="">Tipificacion #2 </option>
      <option value="">Tipificacion #3 </option>
      <option value="">Tipificacion #4 </option>
      <option value="">Tipificacion #5 </option>
    </select>
    <textarea class="form-control" name="name" rows="8" cols="80" placeholder="Observaciones"></textarea>
    <a class="btn btn-default" href="#" role="button" onclick='window.close();'>Guardar y cerrar</a>
  </body>
</html>
    
asked by Yeison E Castiblanco S 26.04.2018 в 22:32
source

3 answers

0

To send what you have in the input you should follow this example that I leave: in the first part of the code comes the form in which you must send the information that is entered in the input:

<form action="segundo.html" method="get">
  <input name="filtro">
  <input type="submit" value="presiona aqui para enviar los datos">
</form>

in the other html you must enter the following code to receive the information and put it in the new input

<input type="text" id="aqui">
<script type="text/javascript">
var url_string = window.location.href; //
var url = new URL(url_string);
var c = url.searchParams.get("filtro");
document.getElementById("aqui").value = c;
</script>
    
answered by 26.04.2018 в 23:23
0

I'll explain how to solve it, you just have to change the function of your link

<a class="btn btn-default" href="FormGestion.html" target="_blank" onClick="abrir_popup(this.href,this.target)" role="button">PopUp</a>

and after

</head>

you must place this code

<script type="text/javascript">
        function abrir_popup(url,ubicacion){
            window.open(url+'?filtro='+document.getElementById('inputPassword').value, ubicacion, 'width=300,height=500'); return false;
        }
    </script>

and to receive it in FormGestion.html

You must change replace this line where you have the comment

<input class="form-control" type="text" name="" value="" id="aqui">

and finally, after

</body>

you add this

<script type="text/javascript">
  var url_string = window.location.href; //
  var url = new URL(url_string);
  var c = url.searchParams.get("filtro");
  document.getElementById("aqui").value = c;
  </script>

and with this it should work

    
answered by 27.04.2018 в 00:49
0

If it works, I'll leave the link with the full code

html1

link

html2

link

    
answered by 27.04.2018 в 03:43