Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting the focus to field

    Hiya folks,
    I have document which when loading sets the focus to a text box (the only one on the form) using the onload="MyTextBox.Focus()". After the user has entered some text here and pressed submit, an IFrame on the form is displayed.

    The user then completes the data on the IFrame and presses the IFrame submit button. On clicking this Submit button I want to be able to set the focus back to the original text box on the 'parent' page. And I haven't got a clue as to how to achieve this.

    Any offers??

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Quote Originally Posted by SxChoc
    …presses the IFrame submit button.…
    On the iframe form mentioned above:
    Code:
    <form … onsubmit="parent.document.forms[0].inputElementId.focus();">
    Change inputElementId to the id used on the original text input field on the parent page.

  • #3
    New Coder
    Join Date
    May 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Got round it by writing a little function on the main page and calling it from the submit or cancel button on the Iframe.

    Thanks for the response.


  •  

    Posting Permissions

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