cancel
Showing results for 
Search instead for 
Did you mean: 

Enable and disable field with checkbox field

Former Member
0 Kudos

Hi all,

I need to disable and enable field with checkbox field.

Help me please.

Follows attached image.

Thanks and Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

RicardoRomero_1
Active Contributor
0 Kudos

Hi,

As suggested the best way is bind the property Enabled with an attibute in the context.

But I think the easiest way to do it is bind the property Enabled directly with the same attribute you use for your check box.  Create an action for event onToggle but is not necessary to put any code there... is only for trigger the event...

I prefer to use the property "Read Only" instead of "Enabled", looks better, you can do it binding the property "Read Only" with the inverse of the value of the attribute of your checkbox.

Regards.

Former Member
0 Kudos

Ricardo,

Again, I agree with you it should be linked to a variable. You can't link it to the same attribute. If you disable it then it can't be enabled again!

RicardoRomero_1
Active Contributor
0 Kudos

mmm, I've created a small application to try this and works fine... I don't get your point, Why can't be enabled again?

Former Member
0 Kudos

I think there is some misunderstanding on my side. The way I understand it is that you want to bind variable "L_FLAG" to the checkbox value and to the checkbox "Enabled" property. Now, if you set the variable to ON by default the checkbox will be marked ON and the field will be enabled. When a user unchecks it, the checkbox will be marked OFF and the field will be disabled.

RicardoRomero_1
Active Contributor
0 Kudos

Now I get your point, but is not necessary to bind the variable L_FLAG to the property Enabled of the checkbox, you need to bind it with the property enabled of the INPUT FIELD.

Although as I said I prefer to use the property Read Only of the Input field with the inverse of the attribute bound with the checkbox. (L_FLAG in this case)

Former Member
0 Kudos

bind enable property of input field with attrbute of type wdy_boolean  change this attribute value  on event On_toggle

Former Member
0 Kudos

Linking to a wdy_boolean context variable is the best way to go as Jitendra suggested. However, I don't think OnToggle is appropriate. Once it is toggled off and the field is disabled, you can't toggle it again.

Changing the flag that enables or disables the checkbox can be done in the WdDoModifyView (or in the post- method of this method in case you are enhancing a standard WDA application).

So, you will have two flag variables: a flag that contains the actual value of the checkbox and a flag that contains whether the checkbox should be enabled/disabled.