| 20 | | $peer_table = _get_option($options, 'peer_table'); |
|---|
| 21 | | $peer_field = _get_option($options, 'peer_field'); |
|---|
| 22 | | $input_name = _convert_method_to_name($method, $options); |
|---|
| 23 | | |
|---|
| 24 | | echo input_auto_complete_tag("${peer_table}_${peer_field}_search", '', |
|---|
| 25 | | sfContext::getInstance()->getModuleName()."/autocomplete?table=$peer_table&field=$peer_field", |
|---|
| 26 | | array('autocomplete' => 'off'), |
|---|
| 27 | | array( |
|---|
| 28 | | 'use_style' => true, |
|---|
| 29 | | 'after_update_element' => "function (inputField, selectedItem) { $('".get_id_from_name($input_name)."').value = selectedItem.id; }", |
|---|
| 30 | | 'method' => 'get' |
|---|
| 31 | | ) |
|---|
| 32 | | ); |
|---|
| 33 | | echo input_hidden_tag($input_name); |
|---|
| | 20 | $peer_table = _get_option($options, 'peer_table'); |
|---|
| | 21 | $peer_field = _get_option($options, 'peer_field'); |
|---|
| | 22 | $input_name = _convert_method_to_name($method, $options); |
|---|
| | 23 | $current_value = ($object) ? $object->$method() : null; |
|---|
| | 24 | |
|---|
| | 25 | $peer_class = sfInflector::camelize($peer_table).'Peer'; |
|---|
| | 26 | $current_value = call_user_func(array($peer_class, 'retrieveByPk'), $current_value); |
|---|
| | 27 | |
|---|
| | 28 | echo input_auto_complete_tag("${peer_table}_${peer_field}_search", $current_value, |
|---|
| | 29 | sfContext::getInstance()->getModuleName()."/autocomplete?table=$peer_table&field=$peer_field", |
|---|
| | 30 | array('autocomplete' => 'off'), |
|---|
| | 31 | array( |
|---|
| | 32 | 'use_style' => true, |
|---|
| | 33 | 'after_update_element' => "function (inputField, selectedItem) { $('".get_id_from_name($input_name)."').value = selectedItem.id; }", |
|---|
| | 34 | 'method' => 'get' |
|---|
| | 35 | ) |
|---|
| | 36 | ); |
|---|
| | 37 | echo input_hidden_tag($input_name); |
|---|