Pass value to modal window, retrieve the data and reuse it

1

Good afternoon everyone. Guys, I have the following difficulty: I have the following screen:

Clickingonthehighlightedbutton(Edit)opensthismodalwindow,whereitpassestherequestID,andthedateasshownintheimage:

MydifficultyistoreusetheinformationIhavepassed.Asyoucansee,IwasabletopassthisinformationandretrieveitviajavaScript,butwhenIsubmitmyform,ortrytocapturethevalueofthefieldbytheid,itreturnsnull.

Ipassedtheinformationasfollows:

Buttonthatcallsmodal,andIpasstheinformationthroughtheattributedata-id='$xid|$dataexibir'

<atype='button'href='#editar'class='btnbtn-primaryespacos'data-toggle='modal'data-target='.editar'data-id='$xid|$dataexibir'id='btnEditar'>

Fieldthatreceivestheinformationinthemodalwindow:

<inputtype="text" class="form-control" name="meuid" id="meuid" disabled="true">

javascript function that I used to pass the data:

   $(document).on("click", "#btnEditar", function () {
        var info = $(this).attr('data-id');
        var str = info.split('|');
        var meuid = str[0];
        var minhadata = str[1];
        $(".modal-body #meuid").val(meuid);
        $(".modal-body #minhadata").val(minhadata);
    });

As you can see in the second image, I try to retrieve this id to make a select and fill that table below with the information already contained for that id, and I can not, nor can I retrieve or submit through the form. I am waiting for some help, and thank you for your attention. Thanks!

    
asked by anonymous 25.02.2016 / 21:08

1 answer

2

You can not capture the data because you set the disabled attribute to true . By doing so, these fields are ignored. It's as if they did not exist.

To solve your problem, remove the disabled attribute and instead of losing the desired effect, add the Bootstrap% class.

<input type="text" class="disabled" id="input1" name="input1">

I hope I have contributed.

@Edit

For future people who have this problem, use disabled

<input type="text" class="form-control" id="input1" name="input1" readonly"

It seems to be the most correct way to achieve this effect.

    
26.02.2016 / 20:56