Solved

SetFocus to an iFrame on a CRM tab

Posted on 2009-05-20
4
1,024 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:jedibozz
  • 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:jedibozz
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:jedibozz
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now