mardi 3 septembre 2019

How to set value in the textbox from database that contain a quotation mark in it?

I am using Laravel and I have an update modal. My data is not set on the modal because one of the data contain quotation mark like in the picture below.

My button's code is like this:

<a type="button" data-toggle="modal" data-target="#cartitem_update_modal" class="dropdown-toggle btn btn-warning btn-circle" onclick="cartitem_update_modal(''
                                       , ''
                                       , ''
                                       , ''
                                       , ''
                                       , '')">
                                      <span class="fa fa-edit" aria-hidden="true"></span>
                                    </a>

and my javascript code is like this:

function cartitem_update_modal(EQC_ID, EQC_ITEM_ID, EQC_ITEM_NAME, EQC_ITEM_QUANTITY, EQC_ITEM_UNIT, EQC_ITEM_REMARK) 
{
    $('#cart_item_id_update').val(EQC_ID);
    $('#cart_item_update').val(EQC_ITEM_NAME);
    $('#cart_item_reserved_quantity_update').val(EQC_ITEM_QUANTITY);
    $('#cart_item_reserved_unit_update').val(EQC_ITEM_UNIT);
    $('#cart_item_remark_update').val(EQC_ITEM_REMARK);
}

And my problem is the Item Name not appear on my textbox <input type="text" class="form-control" id="cart_item_update" readonly> and it is because the data has quotation mark. I tried select the data which not contain quotation mark, and it's worked well, the data showed up in the text box.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire