# Value dependencies

Using lookup select boxes you can set up complex dependencies between values. The target field will be filtered when the page loads and on all changes to the filter field(s).

### <span class="mw-headline" id="bkmrk-single-dependency-1">Single dependency</span>

```javascript
lookupValueFilterOnChange(fieldNameTarget, fieldNameSource, tripleArrayOfConditions);
```

```javascript
var conditions = [
  [ TargetValue, SourceValue ... ],
];
```

```javascript
var conditions = [
  ["Ding", "Foo"],
  ["Dong", "Foo"],
  ["Ding", "Bar"],
];
lookupValueFilterOnChange("LOOKUP", "FILTER", conditions);
```

In the above "Ding" and "Dong" will be available to select when FILTER = "Foo"

### <span class="mw-headline" id="bkmrk-double-dependency-1">Double dependency</span>

```javascript
lookupValueFilterDoubleOnChange(fieldNameTarget, fieldNameSource1, fieldNameSource2, tripleArrayOfConditions);
```

```javascript
var conditions = [
  ["Ding", "Foo", "Cat"],
  ["Dong", "Foo", "Dog"],
  ["Ding", "Bar", "Cat"],
  ["Dong", "Bar", "Fish"],
];
lookupValueFilterDoubleOnChange("LOOKUP", "FILTERA", "FILTERB", conditions);
```

In the above "Ding" will be available to select when either :

- FILTERA = "Foo" -AND- FilterB = "Cat"
- FILTERA = "Bar" -AND- FilterB = "Cat"