Solved

SetFocus to an iFrame on a CRM tab

Posted on 2009-05-20
4
1,043 Views
Last Modified: 2012-06-27
The stunnware site indicates I can switch tabs and set focus to a field by...

// Set focus to the field.
crmForm.all.SOME_FIELD_ID.SetFocus();

In my case the only fields on the Tab are iFrames.

crmForm.all.IFRAME_MyFrame.SetFocus(); generates...
error: 'crmForm.all.IFRAME_MyFrame' is null or not an object.

Help would be appreciated
0
Comment
Question by:Larry Trimble
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Biffster007 earned 125 total points
ID: 24436698
Hi,

Make sure the IFrame name is in the exact case.

Also, ensure the 'Restrict Cross Frame Scripting' check box is unchecked.

Try:

crmForm.all.SOME_FIELD_ID.focus();

Let me know how you get on.

Cheers,
MH
0
 
LVL 11

Assisted Solution

by:rakeshAgarwal
rakeshAgarwal earned 125 total points
ID: 24438580
Other reason might be the iframe is not still loaded when  you try to access the Iframe.  So  you have to write code so that it waits for iframe to be loaded and then  use your code.

Are you writing this code on load event.  

regards
Rakesh
0
 

Author Comment

by:Larry Trimble
ID: 24477316
Hi...thanks for the answers.  I 'm afraid I didn't explain the problem was well as I should have in the first place, and the error I was getting was to be expected.  I was erroneously trying to access the crmForm.all.IFRAME_MyIframe.SetFocus(); from the onSave event of another form.  I now understand that I need to somehow use the parentform properties.

I'm still at an impass with this but haven't had the time to research any possible solutions.  I did howver find out that it's not possible to set focus to an iFrame...apparently only form entry controls can have focus...textboxes, checkboxes, etc...but not iFrames.
When I switch to the tab containing the iFrames, focus seems to go to the topmost entry control on the page.  In my case, the only entry control is a textarea at the bottom of the tab, so whenever I switch to this tab, the tab scrolls to the bottom and focus is set on my text area.  To overcome this I've had to place a checkbox at the top of the tab.  I've read posts with others having this same issue and there doesn't seem to be a solution.

LT
0
 

Author Closing Comment

by:Larry Trimble
ID: 31583556
I ensured I had the correct case for the iFrame name, and that the restrict x-frame scripting was disabled.  No luck.
There is no on load code at all.  It is a simple display page with no user interaction at all...even within the iFrames.
Thanks for your help anyway.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question