diff --git a/frontend/config/modifications.service.ts b/frontend/config/modifications.service.ts
index 21e497d..db2fda0 100644
--- a/frontend/config/modifications.service.ts
+++ b/frontend/config/modifications.service.ts
@@ -64,12 +64,32 @@
         }
     }
 
-    setEdit(node, set = true) {
+    setEdit(activeSession, node, set = true) {
+        let waiting = false;
         if (set && node['info']['datatypebase'] == 'empty') {
             node['value'] = '';
             return;
         }
-        node['edit'] = set;
+        if (set && !('values' in node['info'])) {
+            switch (node['info']['datatypebase']) {
+            case 'bits':
+            case 'enumeration':
+                waiting = true;
+                this.sessionsService.schemaValues(activeSession.key, node['info']['path']).then(result => {
+                    if (result['success']) {
+                        node['info']['values'] = result['data'];
+                    }
+                    node['edit'] = set;
+                });
+                break;
+            case 'boolean':
+                node['info']['values'] = ['true', 'false'];
+                break;
+            }
+        }
+        if (!waiting) {
+            node['edit'] = set;
+        }
     }
 
     setLast(list) {
@@ -89,7 +109,7 @@
         let match = false;
         let parent = null;
         let children = activeSession.data['children'];
-        let newChildren;
+        let newChildren = activeSession.data['newChildren'];
 
         while (children || newChildren) {
             match = false;
@@ -210,7 +230,7 @@
                 /* new record */
                 if (node['value'] == leafValue) {
                     /* no change to the original value */
-                    this.setEdit(node, false);
+                    this.setEdit(activeSession, node, false);
                     this.removeModificationsRecord(activeSession);
                     return;
                 }
@@ -232,7 +252,7 @@
         }
 
         node['value'] = leafValue;
-        this.setEdit(node, false);
+        this.setEdit(activeSession, node, false);
     }
 
     createOpen(schemas, node) {
@@ -287,7 +307,7 @@
         }
 
         switch(newNode['info']['type']) {
-        case 1: { /* container */
+        case 1: /* container */
             node['schemaChildren'].splice(index, 1);
 
             newNode['children'] = [];
@@ -296,17 +316,15 @@
                 this.createOpen(result, newNode);
             });
             break;
-        }
-        case 4: { /* leaf */
+        case 4: /* leaf */
             node['schemaChildren'].splice(index, 1);
 
             if ('default' in newNode['info']) {
                 newNode['value'] = newNode['info']['default'];
             }
-            this.setEdit(newNode, true)
+            this.setEdit(activeSession, newNode, true)
             break;
-        }
-        case 16: { /* list */
+        case 16: /* list */
             let search;
             if ('new' in node) {
                 search = node['children'];
@@ -341,7 +359,7 @@
                         newKey['info'] = newNode['schemaChildren'][i];
                         newKey['path'] = newNode['path'] + '/' + this.schemaName(newNode['info'], newKey['info']);
                         newKey['dirty'] = true;
-                        this.setEdit(newKey, true)
+                        this.setEdit(activeSession, newKey, true)
                         newNode['children'].push(newKey)
                         newNode['schemaChildren'].splice(i, 1);
                     }
@@ -350,7 +368,6 @@
 
             break;
         }
-        }
 
         if (!node['schemaChildren'].length) {
             newNode['last'] = true;
diff --git a/frontend/config/sessions.service.ts b/frontend/config/sessions.service.ts
index b9e5dd2..496d0d6 100644
--- a/frontend/config/sessions.service.ts
+++ b/frontend/config/sessions.service.ts
@@ -137,6 +137,15 @@
             }).toPromise();
     }
 
+    schemaValues(key: string, path: string) {
+        let params = new URLSearchParams();
+        params.set('key', key);
+        params.set('path', path);
+        let options = new RequestOptions({ search: params });
+        return this.http.get('/netopeer/session/schema/values', options)
+            .map((resp: Response) => resp.json()).toPromise();
+    }
+
     alive(key: string): Observable<string[]> {
         let params = new URLSearchParams();
         params.set('key', key);
diff --git a/frontend/config/tree.component.html b/frontend/config/tree.component.html
index 451452a..fa9a9f2 100644
--- a/frontend/config/tree.component.html
+++ b/frontend/config/tree.component.html
@@ -99,10 +99,19 @@
 				(click)="changeValue(node, $event.target)" (keyup.enter)="changeValue(node, $event.target)"
 				onmouseover="this.src='assets/netopeer/icons/confirm_active.svg'"
 				onmouseout="this.src='assets/netopeer/icons/confirm.svg'"/>
-			<input id="{{node['path']}}_input" type="text" class="value" value="{{node['value']}}" tabindex=0
-				(keyup)="checkValue(node, $event.target)" (change)="checkValue(node, $event.target)"
-				(keyup.enter)="changeValue(node, $event.target)" (keyup.escape)="changeValueCancel(node)"
-				checkLeafValue [node]="node" (onCheckValue)="checkValue($event.node, $event.element)"/>
+            <select *ngIf="node['info']['values']"
+                id="{{node['path']}}_input" type="text" class="value"
+                (change)="checkValue(node, $event.target, true)"
+                checkLeafValue [node]="node" [trusted]="true" (onCheckValue)="checkValue($event.node, $event.element, $event.trusted)">
+                <ng-container *ngFor="let value of node['info']['values']; let i='index'">
+                    <option value="{{value}}">{{value}}</option>
+                </ng-container>
+            </select>
+            <input *ngIf="!node['info']['values']"
+                id="{{node['path']}}_input" type="text" class="value" value="{{node['value']}}" tabindex=0
+                (keyup)="checkValue(node, $event.target)" (change)="checkValue(node, $event.target)"
+                (keyup.enter)="changeValue(node, $event.target)" (keyup.escape)="changeValueCancel(node)"
+                checkLeafValue [node]="node" (onCheckValue)="checkValue($event.node, $event.element)"/>
 		</div>
 	</ng-container>
 
diff --git a/frontend/config/tree.component.ts b/frontend/config/tree.component.ts
index 2e3ad09..ef04a3b 100644
--- a/frontend/config/tree.component.ts
+++ b/frontend/config/tree.component.ts
@@ -26,6 +26,7 @@
 })
 export class CheckLeafValue {
     @Input() node;
+    @Input() trusted = false;
     @Output() onCheckValue = new EventEmitter();
 
     constructor(private elRef:ElementRef) {}
@@ -33,9 +34,10 @@
     ngAfterContentInit() {
         console.log(this.node)
         let node = this.node;
+        let trusted = this.trusted;
         let element = this.elRef.nativeElement;
         element.value = node['value'];
-        this.onCheckValue.emit({node, element});
+        this.onCheckValue.emit({node, element, trusted});
   }
 }
 
@@ -170,15 +172,26 @@
         }
         let parent = target.parentElement;
 
-        this.modsService.setEdit(node, true)
+        this.modsService.setEdit(this.activeSession, node, true)
         this.changeDetector.detectChanges();
 
         parent.nextElementSibling.lastElementChild.focus();
     }
 
-    checkValue(node, target) {
+    checkValue(node, target, trusted = false) {
         let confirm = target.previousElementSibling;
         let cancel = confirm.previousElementSibling;
+
+        if (trusted) {
+            /* value is selected from valid options */
+            target.classList.remove("invalid");
+            confirm.style.visibility = "visible";
+            if ('value' in node) {
+                cancel.style.visibility = "visible";
+            }
+            return;
+        }
+
         let path: string;
         if ('creatingChild' in node) {
             path = node['creatingChild']['path'];
@@ -204,7 +217,7 @@
 
     changeValueCancel(node) {
         if ('value' in node) {
-            this.modsService.setEdit(node, false);
+            this.modsService.setEdit(this.activeSession, node, false);
         }
     }
 
