Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to clear Autocomplete text in Jquery.

665735Jun 15 2012 — edited Jun 15 2012
Hi All,


I have implemented a Autocomplete text item using jquery.Every thing looks fine, but when we clear the country the corresponding state should be cleared.
Here is the code, can any body hep me out where and how to clear the values.
--
<script type="text/javascript">
$( function() {
    
    $("#P16_ENG_CTRY").autocomplete({
        source : function( request , response) { 
                        data = getCountry(request.term);
                        response( data );
                 } ,
        focus  : function(event , ui){
                    event.preventDefault();
                 }
 
    });
});
 
function getCountry(key)
{ 
   document.getElementById('P16_ENG_CTRY')==''; 
   var ajaxRequest = new htmldb_Get( null , '&APP_ID.' , 'APPLICATION_PROCESS=GET_COUNTRY' , 0);
   ajaxRequest.add( 'G_MX01' , key);
   ajaxResult = ajaxRequest.get(); 
   
   return ((ajaxResult.length>0)? ajaxResult.split( '~' ):null);
 
}


$( function() {
    
    $("#P16_ENG_STATE").autocomplete({
        source : function( request , response) { 
                        data = getStateJ(request.term);
                        response( data );
                 } ,
        focus  : function(event , ui){
                    event.preventDefault();
                 }
 
    });
});
 
function getStateJ(key)
{ 

  
document.getElementById('P16_ENG_STATE')=='';
      var ajaxRequest = new htmldb_Get( null , '&APP_ID.' , 'APPLICATION_PROCESS=GET_JSTATE' , 0);

          ajaxRequest.add('G_MX01',document.getElementById('P16_ENG_CTRY').value);        
          ajaxRequest.add( 'G_MX03' , key);
          ajaxResult = ajaxRequest.get(); 
   
   return ((ajaxResult.length>0)? ajaxResult.split( '~' ):null);
 
}


$( function() {
    
    $("#P16_ENG_CITY").autocomplete({
        source : function( request , response) { 
                        data = getCityJ(request.term);
                        response( data );
                 } ,
        focus  : function(event , ui){
                    event.preventDefault();
                 }
 
    });
});
Thanks,
Anoo..
This post has been answered by VC on Jun 15 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 13 2012
Added on Jun 15 2012
3 comments
213 views