Get Input Text values within modal-body

0

Expensive;

How to get INPUT TEXT values and direct them to Body-Modal?

I have a form with multiple inputs disabled, so the user does not edit. However, by clicking the button that calls MOdal, I wanted the modal to appear in this modal.

MODAL:

FORM:

Sorry for posting the image, I tried to put the code and it was not going to be formatted. I count on your help.

Thank you.

    
asked by anonymous 31.08.2016 / 01:43

2 answers

1

Expensive;

I solved my problem with the code below:

function copy_form()
{
id('modalxxx').value = id('xxx').value;
id('modalyyy').value = id('yyy').value;
id('modalrrr').value = id('rrr').value;
id('modalttt').value = id('ttt').value;


}

function id( el ){
   return document.getElementById( el );
}
    window.onload = function()
    {
    id('btnenviar').onclick = function()
    }
    copy_form();
}
                 }

</script> 

Thanks for the help:)

    
31.08.2016 / 23:52
0

First thing: The answer I'll give you is using jQuery.

To access the value of an input field using jQuery, make sure that you have set an id for each of them. Then, inside your javascript code, access the value as follows:

var input_value = $("seu_id").val();

To add these values to the form, ideally, when you click "Click Here", retrieve all the values from the input fields, and seven of these values in the fields of your form. For this, you must define blocks of text in your modal, each with an id. Assuming you have an input field with your name, and you want to send it to the modal. Assuming your modal has a parchment as follows:

<p id="nome_modal"></p>

And that in your form you have an input field defined as follows:

<input type="text" id="nome disabled />

Using jQuery, you will:

var nome = $("nome").val();
$("#nome_modal").text(nome);
    
31.08.2016 / 02:24