1: <?php
2: /**
3: * Horde_Form_Action_setcursorpos is a Horde_Form_Action that places
4: * the cursor in a text field.
5: *
6: * The params array contains the desired cursor position.
7: *
8: * Copyright 2006-2012 Horde LLC (http://www.horde.org/)
9: *
10: * See the enclosed file COPYING for license information (LGPL). If you
11: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
12: *
13: * @author Chuck Hagenbuch <chuck@horde.org>
14: * @package Form
15: */
16: class Horde_Form_Action_setcursorpos extends Horde_Form_Action {
17:
18: var $_trigger = array('onload');
19:
20: function getActionScript(&$form, $renderer, $varname)
21: {
22: Horde::addScriptFile('form_helpers.js', 'horde');
23:
24: $pos = implode(',', $this->_params);
25: return 'form_setCursorPosition(document.forms[\'' .
26: htmlspecialchars($form->getName()) . '\'].elements[\'' .
27: htmlspecialchars($varname) . '\'].id, ' . $pos . ');';
28: }
29:
30: }
31: