Forum OpenACS Q&A: Search widget / datatype

Collapse
Posted by Randy Kunkee on
I'm trying to use the search widget. I didn't find much documentation on this feature so after some plowing through acs-templating/tcl/* it looks like one must do something like:

template::element create user_form person_id
    -widget search
    -datatype search
    -label {Name}
    -search_query {
        select last_name, person_id
        from persons
        where last_name like :value} 
    -value $person_id

The value posted does indeed get validated, and I get an error message if I put in a non-existent last name. The system will redisplay the form with a select widget of all possible names if multiple values match the query. It will also translate the entered value into an integer based on the search_query, but right now it won't do it (I've seen it in my travels, but...). Any insights as to why my use of the search widget and datatype are not working? Thanks for a really useful element template.

Collapse
Posted by Jon Griffin on
Has anybody used this with ad_form and had it work?