From ba3030203b28a0daca2791666d973edfc066f13f Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 16 Apr 2012 13:21:08 +0200 Subject: [PATCH] FIX suggestion of ip when subnet id is not the same as array index --- public/javascripts/host_edit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/host_edit.js b/public/javascripts/host_edit.js index e07eff4cb56..0c9568d2502 100644 --- a/public/javascripts/host_edit.js +++ b/public/javascripts/host_edit.js @@ -123,9 +123,9 @@ function subnet_selected(element){ if (subnet_id == '' || $('#host_ip').size() == 0) return false; // We do not query the proxy if the host_ip field is filled in and contains an // IP that is in the selected subnet - var drop_text = $(element).text().split("\n")[subnet_id] + var drop_text = $(element).children(":selected").text(); if (drop_text.length !=0 && drop_text.search(/^.+ \([0-9\.\/]+\)/) != -1) { - var details = $(element).text().split("\n")[subnet_id].replace(/^[^(]+\(/, "").replace(")","").split("/"); + var details = drop_text.replace(/^[^(]+\(/, "").replace(")","").split("/"); if (subnet_contains(details[0], details[1], $('#host_ip').val())) return false; }