A: 

I'm assuming there is more to your code than meets the eye, if so this should do the trick:

$('#connection').change(function(){
    $('#database').val('main_database');
}); 
$('#database').change(function(){
    $('#table').val('payments');    
}); 
$('#table').change(function(){
    $('#fieldcode').val( 'code' );
    $('#fieldcolor').val( 'status' );
});
balupton
A: 

I solved easy...

$.ajax( {complete:function() { $('#database').val('main_database'); $.ajax( {complete:function() { $('#table').val('payments');
$.ajax( {complete:function() { $('#fieldcode').val( 'code' ); $('#fieldcolor').val( 'status' ); }}); }}); } } );

Cristian