Using condition builder field control with depending fields

Ji Pattison-Smith asked on May 18, 2018 10:31

I've got a form within a module where I need two fields to be interdependent - if one is filled in, the other should be disabled, and vice versa. However, one of the fields is using the condition builder form control which is causing the following error when the "has depending fields" checkbox is checked:

[Error loading the FormControl 'ConditionBuilder']
Control with ID 'txtMacro' being registered through RegisterAsyncPostBackControl or RegisterPostBackControl must implement either INamingContainer, IPostBackDataHandler, or IPostBackEventHandler.

Has anyone encountered this, and know how it might be solved? I've tried making the condition builder implement IPostBackDataHandler, which gets rid of that error but doesn't actually work to do what I want it to do (it never hits the implemented methods).

Correct Answer

Ji Pattison-Smith answered on May 22, 2018 11:21

I didn't find a direct solution this, so as a workaround I've modified the condition builder (actually I created a new form control containing a condition builder). I used javascript to poll its value (it's set programatically so there's no input changed event fired) and disable the depending field if it's not empty.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on May 21, 2018 15:09

Any reason you are using a Conditional Builder in this case? You can do the interdependent fields usually without it, just be checking both "This field depends on" and "this field has depending" checkboxes, and setting a macro of the Enabled something like MyField1.Value == "Blah" and MyField2.Value == "etc"

0 votesVote for this answer Mark as a Correct answer

Ji Pattison-Smith answered on May 21, 2018 16:34

Thanks for your reply Trevor. I've got the interdependent fields working with other types of fields, but not with condition builder.

I do need to use condition builder as this field is for editors to build up a macro condition - unless you know of another form control which does something like this?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.