user2430933
user2430933

Reputation: 39

hidden input not submited

Hi i have modal popup have hidden input with id value from database.

<input id="no_id" name="no_id" type="hidden" value="<? echo $no_id;?>">

I have javascript to call the hidden value below

$(document).ready(function(){
   $(".btn").click(function(){
     $("#no_id").val($(this).data('id'));
   });

the problem is when the form submited, the hidden value not submited. Any idea to solve this problems

thanks

.btn to call the modal is below, with data-id as value to hidden input

<a target="_blank" data-id="<? echo $no_id;?>" data-toggle="modal" href="#update_bayar" class="btn mini red"><i class="icon-exclamation-sign"></i></a>

Modal form is here

<form id="myForm" action="action.php" method="get" enctype="multipart/form-data">
<div class="modal fade" id="update_bayar" tabindex="-1" role="basic" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Update Status Bayar</h4>
</div>
<div class="modal-body">

  <div class="span12"><b>Pembayaran Langsung Ke Kas Negara</b>
                                                                <label class="control-label">Nomor NTPN</label>
                                                                <input name="no_ntpn" value="test value" type="text" placeholder="" class="m-wrap span12">
                                                                <label class="control-label">Tanggal NTPN</label>
                                                                <div class="controls">
                                                                <input name="tgl_ntpn" type="text" placeholder="" class="m-wrap span12 date-picker" value="test value">
                                </div><br>
                                  <b>Pembayaran Ke Rekening Bendahara</b>
                                                                <label class="control-label">Nomor Rekening</label>
                                                                <div class="controls">
                                                                <input name="tanggal_bayar" value="test value" type="text" placeholder="" class="m-wrap span12">
                                                                </div>
                                                                <label class="control-label">Lampirkan Bukti Transfer/Rekening Koran</label>
                                    <input type="file" name="file" />
                                                            </div>
                                <div id="output"></div>
                                <div id="progressbox"><div id="progressbar"></div ><div id="statustxt">Loading...</div ></div>

</div>


<div class="modal-footer">
<input id="no_id" name="no_id" type="hidden" value="<? echo $no_id;?>">
<button id="submit" name="submit_status_bayar" type="submit" class="btn green"><i class="icon-save"></i> Simpan</button>
</div>
</div>

</div>
</div>
</form>

got the answer after remove .btn submit class

Upvotes: 0

Views: 108

Answers (1)

Himanshu Upadhyay
Himanshu Upadhyay

Reputation: 6565

I can not understand one thing, you have already given value to that hidden field using PHP code, and then on btn click, you are picking btn's data-id value and assigning it to the hidden field.

I think if the .btn is not having any value with its data-id attribute, then it will set hidden fields with blank.

That is the reason I can see, you are not getting its value in your PHP code.

Upvotes: 0

Related Questions