how to disable a button

Hi,

I have 2 view pages are in the same portlet.

When I try to click element(using command link) in Asyn Table row in first view page, it opens the second view page using the value from first view page & pulls the other related fields for the 2nd view page using flow service (here I’m using the preference to pass the value b/w views in portlet). This is working fine.

But my requirement is: In the second view page I have 2 different command buttons (ex: create & update buttons). One button (create) should be disabled when this 2nd page is getting opened from 1st page. When we open the 2nd page directly other button (update) should be disabled (other one should be enabled).

Tried for the 1st functionality using the below in “beforeRenderResponse” function:

			htmlCommandButton1.setEnabled(false);
			htmlCommandButton1.setActionCommand("Disable");
			htmlCommandButton1.Rendered(false);

None of this worked. Your views please.

  • Sam

try binding a variable to control’s ‘disabled’ property and then set the variable to true or false according to reqmt on initialize.

Hi Sam,

Thats correct Anjni, you can try this approach also if you set the Rendered property of your button as false then your button will not be rendered at run time (as in the code snippet you set rendered as false).
So in order to hide your button you can also try to put the button in a hideable panel and can hide/unhide as per your requirement.
Please check the usage of hideable panel in development guide.

Hi Prateek, Anjni,

Thanks for your reply.
I tried using two tabs for each view page and with disable option it working but when the 2nd view page opens the toggle tab is not displaying. Your views.

  • Sam

Was this resolved already? is there any condition bind to rendered property of tab?