/macros/ThingReference
Type: /type/macro
description: ThingReference
macro: value: $def with (type, name, value, property="key", limit=10)

$add_stylesheet('/static/jquery.autocomplete.css')

$add_javascript('/static/js/jquery/jquery.js')
$add_javascript('/static/js/jquery/jquery.bgiframe.min.js')
$add_javascript('/static/js/jquery/jquery.dimensions.pack.js')
$add_javascript('/static/js/jquery/jquery.autocomplete.js')

$add_javascript('/js/autocomplete.js?format=raw')

$if property == "key":
    <input onfocus="setup_autocomplete('input_$name');" 
        type="text" id="input_$name" name="${name}.$property" value="$value[property]" 
        ac_name="$name" ac_type="$type" ac_property="$property" ac_limit="$limit" ac_enabled="true"
        style="width: 100%;"/>
$else:
    <input onfocus="setup_autocomplete('input_$name')" 
        type="text" id="input_$name" name="_${name}.$property" value="$value[property]" 
        ac_name="$name" ac_type="$type" ac_property="$property" ac_limit="$limit" ac_enabled="true" 
        style="width: 100%;"/>
    <input type="hidden" id="result_$name" name="${name}.key" value="$value.key"/>