how to autoselect by ip format in semantic ui and how to prevent autoslect of added ones in dropdown

Viewed 29

enter image description here enter image description here Setting the forceSelection property to false fixes this problem but then when I manually add it myself as 5.5.5.5 it is not selected

enter image description here

When I enter 5.5.5.5 and click anywhere I want it to be added. how can I do that

  ipDropdown.dropdown({
            action: function (text, value,$selectedItem) {
               if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(value)) {
                  $(this).dropdown('set selected', value);
                   
               }
               else if (_.isEmpty(ipDropdown.dropdown('get value'))) 
               {
                   
               }
            },
            allowAdditions: true,
            forceSelection: true,
            allowReselection:true,
            onAdd: function (value, text) {
               
                ipList.push(text); 
            },
            onRemove: function (value, text) {
                ipList = arrayRemove(ipList, text)
            },
        });

0 Answers
Related