jQWidgets Forums

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 10 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • autocomplete variable input status #63085

    Hugo
    Participant

    Hello guys,

    How to add an autocomplete when the input readonly is false

    I’ve tried so

    $('#name').jqxInput({ height: 30, width: 436, theme: settings.tema }).on('keyup', function(e){
    var enabled = $('#name').prop('readonly'), nome = $.trim( $( this ).val() );
    if( enabled && nome ){
         var source = new $.jqx.dataAdapter({
    	datatype: 'json',
    	datafields: [
    	     { name: 'codays' },
    	     { name: 'codphi' },
    	     { name: 'label' },
    	     { name: 'value' }
    	],
    	url: settings.systemPath + 'ajax/ajax.nova-ostemp.php',
    	data: { search: nome }
         });
         
         $('#name').jqxInput({ source: source }).on('select', function( event ){
         if( event.args ){
    	var value = event.args.item.value;
    	var record = source.originaldata;
    	for( var i = 0; i < record.length; i++ ){
    	     if( record[i].value == value ){
    		$('#code1').val( record[i].codays );
    		$('#code2').val( record[i].codphi );
    		break;
    	     }
    	}
         }
         event.stopImmediatePropagation();
         });
    }
    
    if( !nome ){
         $('#novaos_ospa_codays').val('')
         $('#novaos_ospa_codphi').val('');
    }
    e.stopImmediatePropagation();
    });

    sometimes it works and sometimes not

    autocomplete variable input status #63128

    Dimitar
    Participant

    Hello Hugo,

    The readonly attribute is not applied to inputs by default (it is false). As you can see from the Auto-Complete demo, there are no issues.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.