• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: javascript form.field.FOCUS on page load

javascript form.field.FOCUS on page load 13 years 11 months ago #10625

I am trying to get a form on a landing page to focus the first field on page load, there is a simple javascript to do this - but the form field NAMES always have a [ and ] in the name; example:
<input value="" size="20" name="form[FullName]" id="FullName" type="text"><

Notice - name=form[FullName]

This breaks the javascript:
<script language="JavaScript">
<!--
 
document.userForm.form[FullName].focus();
 
//-->
</script><

Is there a workaround for this? I already have the forms not 'autogenerating' for this one so I can hack it up..
The administrator has disabled public write access.

Re:javascript form.field.FOCUS on page load 13 years 11 months ago #10648

  • andreic
  • andreic's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 733
  • Thank you received: 60
Hello,

Please note that you can use the field name directly, without "[", "]".

Please try adding the following script after your already existing code from the "Form Layout" tab:
<script type="text/javascript">
document.getElementById('first_field_name').focus();
</script>
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
Last Edit: 13 years 11 months ago by andreic.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!