Wednesday, November 9, 2011
Wednesday, November 2, 2011
Drupal autocomplete suggestion click track
What I'm not sure how to do and can't seem to find online is have the form submit when a user clicks a suggestion instead of simply completing that field.
$(document).ready(function(){
Drupal.jsAC.prototype.select = function (node) {
this.input.value = $(node).data('autocompleteValue');
if(jQuery(this.input).hasClass('auto_submit')){
this.input.form.submit();
}
};
})
then on your form item add:
'#attributes' => array('class'=> array('auto_submit')),
$(document).ready(function(){
Drupal.jsAC.prototype.select = function (node) {
this.input.value = $(node).data('autocompleteValue');
if(jQuery(this.input).hasClass('auto_submit')){
this.input.form.submit();
}
};
})
then on your form item add:
'#attributes' => array('class'=> array('auto_submit')),
Subscribe to:
Posts (Atom)