Hi,
i'm trying this wonderful extension, and have a little question.
I've created my own form and wold want to gain autofocus on the first field when the form is showed.
Is possible to do this?
Thanks in advance.
Regards.
i'm trying this wonderful extension, and have a little question.
I've created my own form and wold want to gain autofocus on the first field when the form is showed.
Is possible to do this?
Thanks in advance.
Regards.
Hi balrom,
you can use the domready event and do this, something like this :
in the form HTML box and replace field_id with the real field id!
Cheers
Max
you can use the domready event and do this, something like this :
<?php
$script = "
window.addEvent('domready', function() {
$('field_id').focus;
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
in the form HTML box and replace field_id with the real field id!
Cheers
Max
Thank you max, it works fine!!
I've made a little correction to your code, the javascript focus method must have the brackets ;-)
Regards.
Bart
I've made a little correction to your code, the javascript focus method must have the brackets ;-)
Regards.
Bart
<?php
$script = "
window.addEvent('domready', function() {
$('field_id').focus();
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
Nice catch, thanks Bart! :wink:
Cheers,
Max
Cheers,
Max
This topic is locked and no more replies can be posted.