EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: pixiesfr on May 09, 2016, 06:27:46 AM



Title: Switchbutton with a textbox disabled
Post by: pixiesfr on May 09, 2016, 06:27:46 AM
Hi to all.

I would like to have a switchbutton,with  when you push on it , it enable a switchbox, and when you uncheck, it disable the textbox.

Code Below...

I try on jsfiddle working fine with 1 switchbox.

But on my complete coden where I have 3 switchbox with 3 textbox , I have this error (all ID are different)
Code:
TypeError: _4dd is undefined
var opts=_4dd.options;

I dont know why i have this error .

When i remove this line
Code:
  $('#13T13').textbox('enable');
, if working for the 'else' part.

I

here the code that i used :

HTML :
Code:
 <td width="50">
        <span class="dsR44">
            <input class="easyui-switchbutton" name="SOFTWARE_12[value]" id="12I12">
        </span>
    </td>
    <td> <input value='' name="SOFTWARE_13[detail]" id='13T13' class='easyui-textbox' data-options="validType:'length[5,45]',required:'true',disabled:true," style="width:150px"></td>

JAvascript:
Code:
$(function(){ 
            var sw=$('#12I12').switchbutton({
                required:true,
                onText:'Oui',
                offText:'Non',
                value:'1',
                checked:'true',
                onChange: function(value){
                        if (value === true) {
                            $('#13T13').textbox('enable');
                        } else {
                        $('#13T13').textbox('disable');
                        }
                },
            })
        });


Title: Re: Switchbutton with a textbox disabled
Post by: jarry on May 09, 2016, 08:24:19 AM
Please look at this example http://code.reloado.com/ufesin4/edit#javascript,html. It works fine.


Title: Re: Switchbutton with a textbox disabled
Post by: pixiesfr on May 09, 2016, 10:24:49 AM
Hi,

Thanks for you answer, yes it working, but when i use it in my code , I have this error :

Code:
TypeError: _4dd is undefined
error source line:
var opts=_4dd.options;

The javascript is generated (PHP scripts) when a row is expanded from a datagrid.


Title: Re: Switchbutton with a textbox disabled [Solved]
Post by: pixiesfr on May 10, 2016, 12:26:37 AM
Hi,

As the night give advice, i found that my issue is coming from the html received by onExpandRow that it's used to call the script.

Thank you.