cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the button text with enable/disable feature on UI element

Former Member
0 Kudos

Hi Experts,

I have an requirement as sated below :

I have one label & input field and one button on my view. When I run this application , by default button name should come as Enable and also the input field should be enabled(editable). Now when I press 'Enable' button again the text of button should be changed to Disable also the input field should be non editable(disabled).

Any suggestion should be appreciated.

Thanks & Regards

Manish Gupta

Accepted Solutions (0)

Answers (1)

Answers (1)

nikhil_bose
Active Contributor
0 Kudos

1. Create a boolean attribute 'input_enable' and bind to Input UI element text property

2. Create a String attribute 'btn_label' and bind to Button UI element text property

3. in wdOnInit()


// set input_enable attribute to true and button text as Enabled
wdContext.currentContextElement().setInput_enable( true);
wdContext.currentContextElement().setBtn_label( "Enabled");

4. create Action for Button. in onActionClick()


// set input_enable attribute to true and button text as Enabled
wdContext.currentContextElement().setInput_enable( false);
wdContext.currentContextElement().setBtn_label( "Disabled");

Former Member
0 Kudos

I think he wants to switch it whenever he clicks on the button.

ie in pseudocode


if flag in context node is true {
set flag to false
set button text to "enable"
} else {
set flag to true
set button text to "disable"
}

But this kind of question is incredibly trivial and should be apparent after going through the most basic of tutorials. I would recommend the poster goes through the tutorials; he will learn a lot more and a lot faster than asking trivial basic questions here.