Solved

SetFocus to an iFrame on a CRM tab

Posted on 2009-05-20
4
1,049 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

728 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