Form Field Focus

Results 1 to 8 of 8

Thread: Form Field Focus

  1. #1
    Paul Enockson Guest

    Default Form Field Focus

    Hello,<BR><BR>Is there any way to direct the focus (cursor positioning) to a specific field on an input form when the page loads? Any suggestions would be apreciated.<BR><BR>Thanks in advance.<BR><BR>Paul

  2. #2
    Ryan S Guest

    Default RE: Form Field Focus

    The answer to this is to simply set the tab order of the field that you want to have the focus to the primary tab. That will place the cursor there when the user selects the form.

  3. #3
    Join Date
    Dec 1969
    Posts
    54

    Default RE: Form Field Focus

    In the &#060;body> tag use the OnLoad property, ie.:<BR><BR>&#060;body OnLoad="document.formname.fieldname.focus();"><BR> <BR>replace formname with your form name, fieldname with the field you want to focus on... and voila!<BR>

  4. #4
    Paul E. Guest

    Default RE: Form Field Focus

    Ryan,<BR>Setting the form field tab order doesn&#039t work. Am I missing something?<BR>


  5. #5
    Paul E. Guest

    Default RE: Form Field Focus

    Ricardo,<BR>It looked like the logical answer and you mad it very clear but it didn&#039t work? Any suggestions? Here it is.<BR>&#060;body bgcolor="#FFFFFF" text="#0000000" onload="document.mailto.mail_to.focus();"><BR><BR> Paul

  6. #6
    Join Date
    Dec 1969
    Posts
    133

    Default RE: Form Field Focus

    Make sure that your Form actually has a name.<BR><BR>Not the best example but.... (notice name=)<BR><BR>&#060;form method="POST" action="lcs.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">

  7. #7
    Paul E. Guest

    Default RE: Form Field Focus

    Here is the code:<BR>&#060;body bgcolor="#FFFFFF" text="#0000000" onload="document.mailto.mail_to.focus();"><BR><BR> &#060;form name="mailto" method="post" action="http://www.aglitter.com/business/atemp.asp"><BR><BR>&#060;input type="text" Name="Mail_To" size="26" tabindex="1"<BR>It still isn&#039t working?<BR><BR>Paul

  8. #8
    B.H. Carr Guest

    Default RE: Form Field Focus

    It shouldn&#039t make a difference that the code is in-line in the previous examples, but try putting a function within the &#060;head> tag, then referencing the funtion with "onLoad" in the &#060;body> tag. I am using the following code on some of my pages, with no problems.<BR><BR><BR>&#060;script language="JavaScript"><BR>&#060;!--<BR>function focus() {<BR> document.formname.fieldname.focus()<BR> }<BR>// --><BR>&#060;/script><BR><BR>Obviously...replace "formname", and "fieldname." And then in the &#060;body> tag.<BR><BR>&#060;body onLoad="focus()"><BR><BR>Maybe that will work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •