duanmao2774 2019-07-18 05:48
浏览 87

如何在FORM.blade中禁用selectable

May i ask if, how can i disable a selectable when i click Transaction Type - Billing. Will choose only Billing Type. if i choose Transaction Type - Payment. Will choose only Payment Type? This is my form.blade using php laravel. Just click my url below to show pics.. much appreciate who help.

PHP, LARAVEL

 <script type="text/javascript">
    var transaction_type, sub_type, payment, billing_type;

   transaction_type = $(".filter_transaction_type").ajaxSelect2({
        url : '{{ route('transactiontype.select2') }}',
    }).on('select2:select', function(repo) {
        transactionTypeId = repo.params.data.text ;
      //  $('#transaction_type_id').val(transactionTypeId);
        var subTypeURL;
        switch (transactionTypeId) {
            case 'Billing':
                subTypeURL = '{{route('BillingType.select2All')}}';
                break;
            case 'Payment':
                subTypeURL = '{{route('paymenttype.select2')}}';
                break;
        }

        sub_type = $(".filter_sub_type").ajaxSelect2({
            url : subTypeURL,
        });

    }).on('select2:unselect', function() {
    });

    billing_type = $(".filter_billing_type_id").ajaxSelect2({
        url : '{{route('BillingType.select2Id')}}',
    }).on('select2:select', function(repo) {
        billingTypeId = repo.params.data.id ;
        $('#billing_type_id').val(billingTypeId);
    }).on('select2:unselect', function() {
    });

     payment = $(".filter_payment").ajaxSelect2({
        url : '{{route('paymenttype.select2')}}',
    }).on('select2:select', function(repo) {

        $('.filter_payment').val('');
        paymentId = repo.params.data.id ;
        $('#payment_type_id').val(paymentId);
    }).on('select2:unselect', function() {

    });


       atc_code = $(".filter_atc_code").ajaxSelect2({
        url : '{{ route('atcrate.select2') }}',
    }).on('select2:select', function(repo) {
        atcCode = repo.params.data.text ;
        $('#atc_code').val(atcCode);
    }).on('select2:unselect', function() {
    });


    dr_cr = $(".filter_dr_cr").ajaxSelect2({
        url : '{{ route('interfaceentriesmapping.select2Id') }}',
    }).on('select2:select', function(repo) {

    }).on('select2:unselect', function() {
    });

This is my code, I expect to be disable either BillingType or Payment Type. enter image description here

  • 写回答

1条回答 默认 最新

  • doupu7651 2019-07-18 05:58
    关注

    You didn't provide your html code so I will assume everything you can just change it

    try this:

    $(document).on('change', '#transaction_type', function(e)
    {
     e.preventDefault();
     if($('#transaction_type').val() == 'Billing')
     {
      $('input[name=payment]').attr('disabled', true);
     }
     else if($('#transaction_type').val() == 'Payment')
     {
      $('input[name=billing]').attr('disabled', true);
     }
    });
    

    if your payment or billing is select then just change the input to select

    Hope it helps!

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题