Ver Mensaje Individual
  #3 (permalink)  
Antiguo 02/03/2011, 13:16
Avatar de HiToGoRoShi
HiToGoRoShi
 
Fecha de Ingreso: abril-2008
Mensajes: 849
Antigüedad: 16 años
Puntos: 31
Respuesta: Guardar el id de autocompletar en un hidden

tio ya encontre la solucion, el problema estaba en mi JSON te paso mi javascript

Código Javascript:
Ver original
  1. $("#txtParticipante").autocomplete({
  2.         dataType: 'JSON',
  3.         source: function(request, response) {
  4.             jQuery.ajax({
  5.                 url: "citas/acciones",
  6.                 type: "post",
  7.                 dataType: "json",
  8.                 data: {
  9.                     action: 'buscarParticipante',
  10.                     participante: request.term
  11.                 },
  12.                 success: function(data) {
  13.                     response($.map(data, function(item) {
  14.                         return {
  15.                             id: item.cal_login,
  16.                             value: item.cal_nombre,
  17.                             cal_typeuser: item.cal_typeuser
  18.                         }
  19.                     }))
  20.                 }
  21.             })
  22.         },
  23.         select: function(e,ui){
  24.             $(".participantes").append('<span><input type="hidden" name="hdParticipante_tipo[]" value="'+ui.item.cal_typeuser+'" /><input type="hidden" name="hdParticipante[]" value="'+ui.item.id+'" />'+ui.item.value+'<a href="javascript: return false;">x</a></span>');
  25.             $(".participantes span").last().hide('').slideDown();
  26.         }
  27.     })

Y el json has esto

Código PHP:
Ver original
  1. $i = 0;
  2.                         foreach ($participantes as $participante) {
  3.                             $aux[$i]['cal_login']    = $participante['cal_login'];
  4.                             $aux[$i]['cal_nombre']   = $participante['cal_nombre'];
  5.                             $aux[$i]['cal_typeuser'] = $participante['cal_typeuser'];
  6.                             $i ++;
  7.                         }
  8. echo json_encode($aux);