processwire-issues
processwire-issues copied to clipboard
Inputfields Javascript API: focus() and find() do not work for Repeater field in tab
Short description of the issue
If you have a Repeater field in a FieldsetTab, the focus() and find() functions of the Inputfields Javascript API do not work for the field.
I have a Text field (for comparison) and a Repeater field inside a FieldsetTab:

I have the following hook to add links and JS to focus the inputfields (the find function has the same problem):
$wire->addHookAfter('ProcessPageEdit::buildFormContent', function (HookEvent $event) {
/* @var InputfieldWrapper $wrapper */
$wrapper = $event->return;
/** @var InputfieldMarkup $f */
$f = $event->wire()->modules->get('InputfieldMarkup');
$f->label = 'Links';
$f->value = <<<EOT
<p>These are links to the <a data-focus='text_1' href='#'>Text 1</a> field and the <a data-focus='test_repeater' href='#'>Test Repeater</a> field</p>
<script >
$(document).ready(function() {
$('a[data-focus]').click(function() {
Inputfields.focus($(this).data('focus'));
});
});
</script>
EOT;
$wrapper->add($f);
});
Screencast:

Setup/Environment
- ProcessWire version: 3.0.189