Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, February 21, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Client (Pre-7.2)
Forum to discuss using & developing the legacy SalesLogix Web Client (For versions 7.0 and earlier). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Client (Pre-7.2) | New ThreadView:  Search:  
 Author  Thread: Call Javascript function from another iFrame.
Snow Monkey
Posts: 214
 
Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 07 3:28 PM
I need to set the focus to a specific tab on the custticktabdata template from my close ticket button on ticket details screen.

How can i reference the correct frame and exec a javascript function(which is NOT inline in that template) from my details frame?

Function is ClickTab(formname , tabname)

Any help is appreciated!!
[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 07 4:50 PM
Nandu,

On the template csrticketinfo, I added a button that called a javascript function "testClick()" that lives on the csrticketinfo page. That function looks like this:

function testClick()
{
parent.infodisp.tickettabs.tabs.clickTab("csrtickcalact", "tdeftab");
}


That button, when clicked, selects the "Calendar Activities" tab. is that what you're looking for? Basically, it's a matter of figuring out where you are in the document object model and then finding the way (via parent and the frame names) to the page (and hence the function) you need.

Jeff
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 07 12:04 PM
fiogf49gjkf0d
Thanks Jeff.But thatz what i have been trying since yesterday evening.

The close ticket button is in my ticketinfo page and i am trying to set focus to a specific tab in my tab set.

I tried the following and it wrote a text in my tabdata template.

document.frames[0].frames[0].document.write('function foo(){alert("hi");}');

So thru DOM i am able to get to the correct frame and alert something .But when i try to executre clilckTab , i get this js error...

"Object does not support this method"

Also in the call you provided , what is .tabs???



[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 07 12:58 PM
fiogf49gjkf0d
Nandu,

That's bizarre, because what I posted is selecting the "Calendar Activities" template.

I even tried putting the function on the csrticketinfo template using your DOM reference and it works:

function testClick()
{
//debugger;
//parent.infodisp.tickettabs.tabs.clickTab("csrtickcalact", "tdeftab");
document.frames[0].frames[0].clickTab("csrtickcalact", "tdeftab");
}


Which is still selecting the Calendar Activities tab, so you definitely have the right DOM reference from the template csrticketinfo.

Are you trying to dynamically write a function on that template and then call that function? I don't remember for sure, but I think I tried that and could never get it to work. If all you need to do is select a specific tab, the code above should work.

As for the ".tabs" reference, it's the name of the frame that contains the csrticktabdata template. If you open the template csrticktabs, you'll see the first frame is named "tabs" and the second frame is named "querydata". A diagram is probably the best option, but here's a description of my traversing the DOM:
parent = "main_content", which contains the template csrtickmain, which contains the frame infodisp.
infodisp = top frame that contains ticket details template (csrticketinfo), which contains the iframe named "tickettabs"
tickettabs - iframe that contains template csrticktabs, which contains the frames tabs and querydata
tabs - the frame that contains the tab names/links (the javascript template)
querydata - the frame that contains the data for the clicked tab

If you post your javascript that you're using to actually call the clickTab function, I can try it.

Jeff
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 07 1:52 PM
Jeff ,
When i do this , i get a msgbox with this url.
alert(document.frames[0].frames[0].location);

http://crmt01/scripts/slxweb.dll/view?name=custticktabdata&tickid=t6UJ9A000SUJ&accid=A6UJ9A001CJ1&return=

So i am referencing the correct template where my js function clickTab resides


function custChangeStatus() {
var f = document.mainform;
var tickresol=document.getElementById('c_its_ticket_resolution').value;
f.action = "<#SYS name=swcpath>/action?name=custtickopenclose&id=<#F name=ctickid>&tickid=<#F name=ctickid>&typeid=gOpen";

if (document.all.custopenclose.innerText == 'Close Ticket' && tickresol=="")

{
alert("Please Enter the Ticket Resolution and Update it Before Closing the Ticket");

//Set default Focus to my tab custtickdetailsform which has ticket resolution
document.frames[0].frames[0].clickTab("custtickdetailsform","tdeftab");
}
else
{
if (document.all.custopenclose.innerText == 'Close Ticket') {

if ((requiredvalidation(document.all.mainform))==true)
{
//close the ticket and post the appropriate activity
//change Status Text to Closed By Customer
//display ticket search screen with All open group

f.custaction.value = 'close';
f.nextpage.value = 'custsearchfrmtick';
f.target = 'main_content';
f.submit();
}
}
else {

document.mainform.custaction.value = 'reopen';
f.nextpage.value = '<#SYS name=template>';
f.submit();
}

}

}
[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Apr 07 2:31 PM
Nandu,

First, my apologies I was looking at csrticketinfo, not custticketinfo. I just made changes to custticketinfo, though, and got it to work.

I don't have a tab named "custtickdetailsform", so I can't make that the active tab. However, I used the "custtickattachmain" tab view. In the template "custticktabdata", do you have a line like this:

TabID[2] = "custtickdetailsform";


along with all the other TabXXX arrays filled out for your custom tab? The name of the tab view to call should be the one in the TabID value.

Here's the code that I used that worked. Note I put a "return;" after selecting the tab so the ticket doesn't get closed and I cut out the rest of the code. But the line with the clickTab call works, and it selects my tab.

function custChangeStatus() {
var f = document.mainform;
//debugger;
document.frames[0].frames[0].clickTab("custtickattachmain", "tdeftab");
return;
< code cut for brevity >
}


Can you get it to select an out of the box tab?

Jeff
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 07 9:28 AM
Jeff

My bad!!!

Initially i screwed up the refernce to that particular dom as i started using the Top.Frame[n].* approach and couldnt call the js fn correctly.then i cloned the fn in the head tag of custticktabdata which i think changed the scope of the fn.Again couldnt reference it properly.Now i moved the funtion to the body tag and it worked!

Also finally i analysed how exactly the frames were and then i started using the doc.frame[0].*approach and used the js function from the include(the way you've posted) and it worked too!

Thanks Jeff

and BTW , we deployed Sp6 on our customer portal and since then no outages on our production box

I am anxiously waiting for 7.2 when they completely revamp the web architecture.
[Reply][Quote]
Jeff Ballard
Posts: 326
 
Re: Call Javascript function from another iFrame.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 07 10:48 AM
Glad it's working. The web client demands patience from developers.

Beta 2 for the new version of the web client is up, if you have access to the beta. I've navigated through some of the pages but haven't done anything to customize it yet. I'm not sold on the look and feel of it yet, but I've only looked at it once, so it may grow on me.

Jeff
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/21/2025 5:45:55 AM