The Toolkit for Online Communities
17120 Community Members, 1 member online, 1998 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : User Smart Search Widget with Ajax : One Message

Forum OpenACS Development: Re: Res: Re: Res: Re: User Smart Search Widget with Ajax

Hi Eduardo, I install again the package in /ajax. When I copy the files (acs-integration-procs.tcl,head-procs.tcl,blank-master.adp....etc) into the following location I have that error in server:

Undefined callback subsite::get_extra_headers
while executing
"error "Undefined callback $callback""
(procedure "callback" line 11)
invoked from within
"callback subsite::get_extra_headers"
invoked from within
"join [callback subsite::get_extra_headers] "\n""
invoked from within
"append head [join [callback subsite::get_extra_headers] "\n"]"
("uplevel" body line 57)
invoked from within
"uplevel {
ad_page_contract {
This is the highest level site specific master template.
site-master adds site wide OpenACS functionality to e..."
(procedure "code::tcl::/var/lib/aolserver/oacspa/www/site-master" line 2)
invoked from within
invoked from within
"if { [file exists $__adp_stub.tcl] } { ....

What can I do.

Posted by Eduardo Santos on
Hi Lourdes,

This problem seems to be related with the package versions you are using. Can you take a look at wich versions you are using? Take a look at the file /acs-admin/apm link for the acs-templating and acs-subsite packages, please.

Posted by Eduardo Santos on
Sorry Lourdes. I've seen in your previous post that you are using OpenACS 5.2.3, right? In order to the Ajax Jelper to work in this version, there can be some complications. The problem you've reported indicates that there was'nt yet the subsite callback that creates the template::head API's.

Maybe this link can help you:


I remember to make it work on 5.2.3, but I don't remember how I did it. I'm going to check my commit log and show you latter.


Hi Eduardo: The OpenACS is 5.2.2 and the AjaxHelper version is 0.87d.
Hi Eduardo: Do you check your commit logs ? thanks.
Hi Eduardo: Do you check?
Hi Lourdes,

What do you mean if I check my commit logs?

Posted by Lourdes Martínez on
Hi Eduardo, you mention previously that you don't remember how you did it, and you were going to review your commit logs and show me later.

I could not have resolved the problem yet. I only need to integrate the smart search widget (autosuggest) in a text box with the openacs doing only a select /n from a table.

Thanks for your help.

Posted by Ryan Gallimore on
Hi Lourdes,

Is it possible for you to upgrade your instance to version 5.4.3?

This is going back a ways, but I think the widget was developed without template::head.

If not, please post your code to pastebin.org so we can take a look.


Posted by Lourdes Martínez on
Ok, I will update my instance to the version 5.4.3. I don't know if that version have the ajaxhelper package.

I only need that the box show me the results of my select depending on the letter I write.

I show you my tree files:

1. smart-search-widget.tcl
set js_update_user_select [ah::ajaxupdate \
-container "results_box" \
-url "search-users" \
-pars "Form.serialize('searchform')"]

2. smart_search_widget.adp

<.. id="searchform">

<.. type="text" name="search" id="search" onKeyUp="@js_update_user_select;noquote@ document.getElementById('results_box').style.visibility='visible';" autocomplete="off" value="" />

3. search_users.tcl
ad_page_contract {

@author Ryan Gallimore (rgallimore@viscousmedia.com)
@creation-date 2006-09-23

} {
{search ""}

#ns_log notice "private-messaging search='$search'"

if { [string length $search] == 0 } {
ns_write "No results"
} elseif { [string length $search] < 3 } {
# Show all results if search string is 1 or two characters.
set search ""

set search [string tolower $search]

set package_id [ad_conn subsite_id]

set response ""

# Get users in the current subsite only

db_foreach get_search_results "

select n,n,n
from my_table
order by n

# select distinct u.username,
# p.first_names || ' ' || p.last_name as name,
# u.username as email
# from pers p, use u, acs_rels rel, app_groups ag
# where p.person_id = u.user_id
# and u.user_id = rel.object_id_two
# and rel.object_id_one = ag.group_id
# and ag.package_id = :package_id
# and (lower(p.first_names || ' ' || p.last_name) like '%$search%'
# or lower(u.username) like '%$search%')
# order by name

" {

set one_result "$name ($email)"

# Bold search text as you type
set start [string first $search [string tolower $one_result]]
set end [expr $start + [string length $search]]
set one_result_bolded "[string range $one_result 0 [expr $start-1]][string range $one_result [expr $start] $end][string range $one_result [expr $end+1] [expr [string length $one_result] - 1]]"

append response "$one_result_bolded

} if_no_rows {
set response "No results"

ns_write $response


Hi Eduardo / Hi Ryan:

Finally I could run the smart-search-widget!!! doing the upgrade and install the ajaxhelper package. Thankssss!

Now I need another help: when I write any letter in the box, the result bring me all the word that exist in the table.

I only need that the box go recognizing letter by letter and do a filter, and when I select my choice, this return into the box..

I'm not sure what .js file do this function?

Thanks again.

Hi Eduardo / Ryan:

I found the way to return exactly the letters I write...

How I do to select my choice and return this value into the box?

Hi Lourdes,

I'm glad you got the widget working with ajaxhelper.

Just click on the link and that will select the user and send you to another page.

If you want to change the link, look for it in user.tcl

For different behaviour, read through the ajaxhelper docs and see if you can find what you're looking for there.