cancel
Showing results for 
Search instead for 
Did you mean: 

Tab click event not firing after Archer 6.7 upgrade

lokeshkumar449
Contributor III

Hi,

         on load of an application based on a field value i should be able to switch between tabs.

in 6.4 version i was using   $("ul.rtsUL li.tab_3123").click();   which use to click 3123 tab on load.

after upgrade it is not working and getting below error:

TypeError: Unable to get property 'srcElement' of undefined or null reference

 

Existing code that used to work before upgrade:

<script>
$(document).ready(function () {
var tab;
var a = $.trim($('#master_DefaultContent_rts_sxxx_fxxxxc').text()).slice(0,1);
if(a>=3){
try{
$("ul.rtsUL li.tab_3123").click(); 

}
catch(e)
{
alert(e);
}
}

 

 

after googling and search in archer community tried below:

tabStrip = $find('master_DefaultContent_rts_ts1948_t');
tabStrip.set_selectedIndex(1);

this is selecting first tab which is what i am looking for but screen is frozen with loading symbol.

-------------------------------------------------

tab = $('li.tab_3123').find('a.rtsLink').trigger('click');
tab.find('span.rtsTxt').trigger('click');

same error as first implemented click() event

 

tab set HTML in Archer:

attached as tab click.png

 

any help is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Try,

<script>
Sys.Application.add_load(function() {
try{
//'use strict';
var a = $.trim($('#master_DefaultContent_rts_s566_f29471c').text()).slice(0,1);
if(a>=3){
var tabStrip = $find('master_DefaultContent_rts_ts1948_t');
tabStrip.get_tabs().getTab(1).click();
}
} catch(e){alert(e);}
});
</script>

There's no need for the <html> or <body> tags.  Archer injects the custom object into the existing DOM.

 Advisory Consultant - Archer, an RSA Business

View solution in original post

12 REPLIES 12

ScottHagemeyer
Archer Employee
Archer Employee

LokeshKumar polamarasetty,

 

Instead of using a custom object to click on a tab after the record has loaded, why not just set that tab to be the default? It accomplishes the same thing without any custom code.

Hi Scott Hagemeyer‌,

            thank you for your reply , actually the tab click will be based on a field value if you see existing code that is mentioned above  if(a>=3)   this a is a field value, if this is below 3 then first tab should be shown by default.

lokeshkumar449
Contributor III

Hi,

      any suggestions are highly appreciated.

lokeshkumar449
Contributor III

Hi David Petty‌ i have seen you providing great solutions for custom objects can you please see if you can provide with any suggestion?

DavidPetty
Archer Employee
Archer Employee

Hi LokeshKumar

 

To select a specific tab use,

tabStrip.get_tabs().getTab([tabIndex]).click();

The tabIndex is the tab number -1.  So if say you want the second tab the tabIndex would be 1.

 Advisory Consultant - Archer, an RSA Business

Hi David Petty‌ 

        thank you very much for the reply above gettab([1]) worked in chrome

but in IE 11 throwing error:

TypeError: Accessing the 'caller' property of a function or arguments object is not allowed in strict mode.  and screen is freezing with in progress image.

 

i removed variable and used below to test and same IE 11 throwing error:

<html>
<script>
$(document).ready(function () {
try{
//'use strict';
var a = $.trim($('#master_DefaultContent_rts_s566_f29471c').text()).slice(0,1);
if(a>=3){
var tabStrip = $find('master_DefaultContent_rts_ts1948_t');
tabStrip.get_tabs().getTab([1]).click();
}
}
catch(e){alert(e);}
});
</script>
<body>

</body>
</html>

Try,

<script>
Sys.Application.add_load(function() {
try{
//'use strict';
var a = $.trim($('#master_DefaultContent_rts_s566_f29471c').text()).slice(0,1);
if(a>=3){
var tabStrip = $find('master_DefaultContent_rts_ts1948_t');
tabStrip.get_tabs().getTab(1).click();
}
} catch(e){alert(e);}
});
</script>

There's no need for the <html> or <body> tags.  Archer injects the custom object into the existing DOM.

 Advisory Consultant - Archer, an RSA Business

thank you very much David Petty‌  you are awesome, injecting through add_load than document ready made the trick.

would you recommend using add_load for custom objects than ready function.

Anytime

 

The add_load is use being it fires after Archer load all the data and controls.  Typically the ready function fires before that and sometimes you get mixed results using the ready function.

 Advisory Consultant - Archer, an RSA Business