Friday, 15 July 2011

grails - "Autocomplete is not a function" Javascript error -



grails - "Autocomplete is not a function" Javascript error -

in grails project (version 2.2.1) i'm using next javascript code in 2 different gsp pages.

<g:javascript> $(document).ready(function() { $.ajax({ type: "get", url: "/medicalofficemanager/patient/getallpatients", datatype: "json", success : function(response) { //create map. var info = $.map(response, function(item){ console.log("id: " + item.id); console.log("name: " + item.surname + " "+ item.name); return{ id: item.id, value: item.surname + " " + item.name } }); $("#patient_textfield").autocomplete({ source: data, select: function (event, ui){ console.log("selected id:" + ui.item.id); console.log("selected name:" + ui.item.value); //when country selected(ie: type china , press enter), //change value of hidden field country's id. $('#patient_id').val(ui.item.id); console.log("patient value = "+ $('#patient_id').val()); } }); } }); }); </g:javascript>

in 1 gsp works expected, in one, looking @ javascript console, have next error:

$(...).autocomplete not function

i've read this discussion, not work me.

any suggestion?

edit: i've noticed difference betweeen pages that, in not working one, loaded bundle-bundle_core_head.js, don't see loaded in gsp page...

edit2: there component loading in other gsp includes before version of jquery , jquery ui, need component because, if comment it, field allows me take date , time not work. possible utilize both?

the autocomplete function provided jquery plugin including in 1 page, not other. view source of each page , compare <script> elements in each.

javascript grails autocomplete

No comments:

Post a Comment