cancel
Showing results for 
Search instead for 
Did you mean: 

Can I dynamically hide a button in Hybrid Container?

eaksiri
Explorer
0 Kudos

I created a button on the screen in Hybrid Container. However, I'm wondering if there is an option to dynamically hide a button?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

function customAfterShowScreen(var screenKey)

{

if(screenKey==="YOUR_SCREEN_KEY")

{

//visible

document.getElementByID("buttonid").style.visibility='visible';

//to hide

document.getElementByID("buttonid").style.visibility='hidden';



}


}

eaksiri
Explorer
0 Kudos

Hi Raja,


Thanks for the response.

However, I tried with your code but still the button is not hidden. I'm not sure if there is something else I should do prior to add the code?

Thanks again.

Former Member
0 Kudos

Hi,

It must work..

Please correct the method name to getElementById()

I wrongly mentioned in the previous post as getElementByID()

eaksiri
Explorer
0 Kudos

Hi Raja,

I have used the method getElementById() already but still didn't work.

I think I may mention the question wrongly. What I want to do is to hide a menu item not a button on the screen.

Former Member
0 Kudos

You an use removeAllMenuItems() to hide all menu items...

To hide all menu items, we have API in SUP... I don't know exactly why they have not provided to hide the menu items individually by providing the key.

Still I hope, we can hide/show the menus by getElementById().

You would have passed the menu key directly. But you should concatenate the screenKey with menu key to get the element..

Try

function customAfterShowScreen(var screenKey)

{

if(screenKey==="YOUR_SCREEN_KEY")

{

//visible

document.getElementById(YourScreenKey+menuKey).style.visibility='visible';

//to hide

document.getElementById(YourScreenKey+menuKey).style.visibility='hidden';

}

}


eaksiri
Explorer
0 Kudos

Thank you very much, Raja!

removeAllMenuItems() is working!

I really appreciate your help.

Answers (2)

Answers (2)

Former Member
0 Kudos

hi eksari/Jitendra,

Yes you can hide any component in work flow screen dynamically.Once you genreated the mobile work flow package, you will be able to see one file called custom.js. All kind of customization should do in this class. In this class we've different events are available. you can write your code in any of this Functional block.

Thanks

Dinesh.

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dinesh,

Could you exaclty tell me how to insert code in custom.js file ?

there are lot of function showing in the file. i am not exactly getting where i should code.

you may follow any simple example.

Thanks,

Jitendra

Former Member
0 Kudos

Jitendra,

Methods available in that class are life cycle events, Depends upon your requirement you can add the js code which will hide your button. You can access your button using the key name of your button component.

Thanks,

Dinesh.

Former Member
0 Kudos

Jitendra,

For example if you want to hide the button when the workflow starts, You have write the code to hide the button in following method. Before loading workflow screens will not available.

 

function customAfterWorkflowLoad()

{

Write your code to hide button.

}

PS: Once you generated the workflow pacakage, you can go through this class. every method will have its comment and example code also. You can go through that and have better understanding

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dinesh,

i ll chck it.

Thanks for your suggestion.

eaksiri
Explorer
0 Kudos

Hi,

I'm wondering if you could be more specific that what is the exact code I should put in order to hide a button?

Thanks in advance!

Former Member
0 Kudos

Hi Ekasiri

I would like to know in which version of SUP, you wants this

Thanks

Dinesh

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dinesh/ Ekasiri,

i am having the same query for SUP 2.1

i want to hide an input field on my screen , during run time i dont want that to be displayed on my
screen as i am hardcoding it .

Regards,

Jitendra

Former Member
0 Kudos

hi eksari/Jitendra,

Yes you can hide any component in work flow screen dynamically.Once you genreated the mobile work flow package, you will be able to see one file called custom.js. All kind of customization should do in this class. In this class we've different events are available. you can write your code in any of this Functional block.

Thanks

Dinesh.