Solved

SetFocus to an iFrame on a CRM tab

Posted on 2009-05-20
4
1,027 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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