
<div id="productIdDiv">
    <input type="hidden" name="proIsOptic" id="proIsOptic" value=""/>
    <div class="form-group col-lg-3">
        {if $catData->isOptic == 2}
        <label class="sr-only">المقاسات والالوان</label>
        {else}
        <label class="sr-only">المنتجات</label>
        {/if}
        <select class="select2 wdt300" name="productId" id="productId">
            <option value="-1">اختر منتج</option>
            {foreach $products as $data}
            <option value="{$data->productId}" data-optic="{$data->isOptic}">{$data->productName}</option>
            {/foreach}
        </select>
    </div>
</div>
{literal}
<script>
    $('#productId').select2();
    $('#productId').live('change', function () {
        var isoptic = $('#productId option:selected').attr('data-optic');
        $('#proIsOptic').val(isoptic);
    });
</script>
{/literal}