views:

38

answers:

0

Hi all - I need to programatically show qtip tooltips as error notifiers in a form I am working on. The form submits via ajax, and returns an object with an action, and if there are error an array of field names with error text to be show.

if (response.action == 'error') {
  // We would put tooltip on appropriate items here
  for (var key in response.text){
    //alert( "Key: " + key + " Value: " + response.text[key] );
    jQuery(key).qtip({
      content: {
        text: response.text[key],
        prerender: true
      },
      style: {
        theme: 'red',
        tip : {corner : "bottomLeft", size : { x : 12, y : 12 }}
      },
      position : {
        corner : {
          target : "topRight", 
          tooltip : "bottomLeft"
        }
      },
      show : {
        ready : true, // show when created on orderError call
        when : false // never show unless explicitly called
      }

    });
  jQuery(key).qtip("show");
  }
}

Above is the relevant chuck of code - stepping through it, it all seems to be fine, but I can't get the tooltips to fire up and show on the page. Has anyone had success doing this or is there anything obvious I am doing wrong?