This topic is locked

HIDE TAB

12/3/2019 9:12:00 AM
PHPRunner General questions
O
oliviercoulon@free.fr author

Hello
How to hide a tab based on a value of a field?
Thanks you very much

J
jacques 12/3/2019



Hello
How to hide a tab based on a value of a field?
Thanks you very much


on "before display":

get fieldvalue

$x123 = "hide";

pass it with $pageObject->setProxyValue("tab1", #x123);
on Javascript Onload:
var tabs = pageObj.getTabs();

if(proxy.tab1 =="hide"){

tabs.hide(1);

}
see manual
https://phprunner.com/phprunner/docs/hide.htm

O
oliviercoulon@free.fr author 12/3/2019



on "before display":

get fieldvalue

$x123 = "hide";

pass it with $pageObject->setProxyValue("tab1", #x123);
Thanks
Where is my error ?
musicien is my fields
var ctrlMusicien = Runner.getControl(pageid, 'musicien');
var tabsLoad = pageObj.getTabs();
if (ctrlMusicien.getValue()=="faux"){

tabs.hide(2);

tabs.hide(3);

tabs.hide(4);

tabs.hide(5);

}

else {

tabs.show(2);

tabs.show(3);

tabs.show(4);

tabs.show(5);

}

;
on Javascript Onload:
var tabs = pageObj.getTabs();

if(proxy.tab1 =="hide"){

tabs.hide(1);

}
see manual
https://phprunner.com/phprunner/docs/hide.htm

O
oliviercoulon@free.fr author 12/3/2019

var ctrlMusicien = Runner.getControl(pageid, 'musicien');
var tabsLoad = pageObj.getTabs();
if (ctrlMusicien.getValue()=="faux"){

tabs.hide(2);

tabs.hide(3);

tabs.hide(4);

tabs.hide(5);

}

else {

tabs.show(2);

tabs.show(3);

tabs.show(4);

tabs.show(5);

}

;

O
oliviercoulon@free.fr author 12/3/2019

THANKS
where is my error ?
musicien is a field(boolean)
var ctrlMusicien = Runner.getControl (pageid, 'musicien');
var tabsLoad = pageObj.getTabs ();
if (ctrlMusicien.getValue () == "faux") {

tabs.hide (2);

tabs.hide (3);

tabs.hide (4);

tabs.hide (5);

}

else {

tabs.show (2);

tabs.show (3);

tabs.show (4);

tabs.show (5);

}

Sergey Kornilov admin 12/3/2019

What does this code do now? Any Javascript errors?

https://xlinesoft.com/phprunner/docs/troubleshooting_javascript_errors.htm

O
oliviercoulon@free.fr author 12/3/2019



What does this code do now? Any Javascript errors?

https://xlinesoft.com/phprunner/docs/troubleshooting_javascript_errors.htm

O
oliviercoulon@free.fr author 12/3/2019

the tab are not hide

O
oliviercoulon@free.fr author 12/4/2019

No error but the tab are not hide !!

K
keithh0427 12/4/2019

You have:

var tabsLoad = pageObj.getTabs();
and using:

tabs.hide(2);

tabs.hide(3);

tabs.hide(4);

tabs.hide(5);
try this:

var tabs = pageObj.getTabs();

O
oliviercoulon@free.fr author 12/4/2019



You have:

var tabsLoad = pageObj.getTabs();
and using:

tabs.hide(2);

tabs.hide(3);

tabs.hide(4);

tabs.hide(5);
try this:

var tabs = pageObj.getTabs();


Thanks, it s good.
How to hide on the click of a field ?

K
keithh0427 12/4/2019

I have something similar in my project, but it's based on field values, not clicking on the field.
On the Add page I have the following code in the JavaScript OnLoad event. Maybe this will help for inspiration.
var ctrlField1 = Runner.getControl(pageid, 'Field1');

var tabs = pageObj.getTabs();
ctrlField1.on('change', function(e) {

if (this.getValue() == 'Y') {

tabs.show(6);

} else {

tabs.hide(6);

}

});
For the Edit page, I have this. Again, use ofr inspiration.
var ctrlField1 = Runner.getControl( pageid, 'Field1' ) ;

var ctrlField2 = Runner.getControl( pageid, 'Field2' ) ;
var tabs = pageObj.getTabs() ;
if ( ctrlField1.getValue() == 'Y' ) {

tabs.show( 6 ) ;

} else {

tabs.hide( 6 ) ;

}
if ( ctrlField2.getValue() == 'N' ) {

tabs.hide( 7 ) ;

} else {

tabs.show( 7 ) ;

}
ctrlFiueld1.on( 'change', function ( e ) {

if ( this.getValue() == 'Y' ) {

tabs.show( 6 ); }

else {

tabs.hide( 6 ); }

}

) ;