modules/admin-full: add field validation for hostnames in leases and hosts pages
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 22 Feb 2011 09:52:49 +0000 (09:52 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 22 Feb 2011 09:52:49 +0000 (09:52 +0000)
modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua
modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua

index 3f631b38b989169225ab5e2af375f3f749c35da0..e0e65e5e4d61e28d6fa14d62b942af4e08c796ac 100644 (file)
@@ -31,6 +31,8 @@ s.anonymous = true
 s.template = "cbi/tblsection"
 
 name = s:option(Value, "name", translate("Hostname"))
+name.datatype = "hostname"
+name.rmempty  = true
 
 mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
 mac.datatype = "macaddr"
index fa8b217de44ca4ab4163f972bd6e3e79963c7afd..c791a57d0f6d5bb071a02d6ffb5e55727a55c2d0 100644 (file)
@@ -23,7 +23,13 @@ s.anonymous = true
 s.template = "cbi/tblsection"
 
 hn = s:option(Value, "name", translate("Hostname"))
+hn.datatype = "hostname"
+hn.rmempty  = true
+
 ip = s:option(Value, "ip", translate("IP address"))
+ip.datatype = "ipaddr"
+ip.rmempty  = true
+
 for i, dataset in ipairs(luci.sys.net.arptable()) do
        ip:value(
                dataset["IP address"],