end
-s:option(Value, "check_interval",
- translate("Check for changed IP every")).default = 10
+ci = s:option(Value, "check_interval", translate("Check for changed IP every"))
+ci.datatype = "and(uinteger,min(1))"
+ci.default = 10
+
unit = s:option(ListValue, "check_unit", translate("Check-time unit"))
unit.default = "minutes"
unit:value("minutes", translate("min"))
unit:value("hours", translate("h"))
-s:option(Value, "force_interval", translate("Force update every")).default = 72
+fi = s:option(Value, "force_interval", translate("Force update every"))
+fi.datatype = "and(uinteger,min(1))"
+fi.default = 72
+
unit = s:option(ListValue, "force_unit", translate("Force-time unit"))
unit.default = "hours"
unit:value("minutes", translate("min"))
s:option(DummyValue, "_time", translate("Current system time")).value = os.date("%c")
-s:option(Value, "interval", translate("Update interval (in seconds)")).rmempty = true
-s:option(Value, "count", translate("Count of time measurements"), translate("empty = infinite")).rmempty = true
+interval = s:option(Value, "interval", translate("Update interval (in seconds)"))
+interval.datatype = "and(uinteger,min(1))"
+interval.rmempty = true
+count = s:option(Value, "count", translate("Count of time measurements"), translate("empty = infinite"))
+count.datatype = "and(uinteger,min(1))"
+count.rmempty = true
s2 = m:section(TypedSection, "ntpdrift", translate("Clock Adjustment"))
s2.anonymous = true
s2.addremove = false
-s2:option(Value, "freq", translate("Offset frequency")).rmempty = true
+
+freq = s2:option(Value, "freq", translate("Offset frequency"))
+freq.datatype = "integer"
+freq.rmempty = true
s3 = m:section(TypedSection, "ntpserver", translate("Time Servers"))
s3.anonymous = true
s3.template = "cbi/tblsection"
s3:option(Value, "hostname", translate("Hostname"))
-s3:option(Value, "port", translate("Port")).rmempty = true
+port = s3:option(Value, "port", translate("Port"))
+port.datatype = "port"
+port.rmempty = true
return m
s:option(DummyValue, "_time", translate("Current system time")).value = os.date("%c")
-s:option(Value, "interval", translate("Update interval (in seconds)")).rmempty = true
-
+interval = s:option(Value, "interval", translate("Update interval (in seconds)"))
+interval.datatype = "and(uinteger,min(1))"
+interval.rmempty = true
s3 = m:section(TypedSection, "ntpserver", translate("Time Server"))
s3.anonymous = true
s3.template = "cbi/tblsection"
s3:option(Value, "hostname", translate("Hostname"))
-s3:option(Value, "port", translate("Port")).rmempty = true
+port = s3:option(Value, "port", translate("Port"))
+port.datatype = "port"
+port.rmempty = true
return m
s:option(Flag, "halfduplex", translate("Half-duplex"))
-s:option(Value, "download", translate("Download speed (kbit/s)"))
+dl = s:option(Value, "download", translate("Download speed (kbit/s)"))
+dl.datatype = "and(uinteger,min(1))"
-s:option(Value, "upload", translate("Upload speed (kbit/s)"))
+ul = s:option(Value, "upload", translate("Upload speed (kbit/s)"))
+ul.datatype = "and(uinteger,min(1))"
s = m:section(TypedSection, "classify", translate("Classification Rules"))
s.template = "cbi/tblsection"
s = m:section(NamedSection, "wan", "interface", translate("Internet Connection"))
s:option(Flag, "enabled", translate("Quality of Service"))
-s:option(Value, "download", translate("Downlink"), "kbit/s")
-s:option(Value, "upload", translate("Uplink"), "kbit/s")
+
+dl = s:option(Value, "download", translate("Downlink"), "kbit/s")
+dl.datatype = "and(uinteger,min(1))"
+
+ul = s:option(Value, "upload", translate("Uplink"), "kbit/s")
+ul.datatype = "and(uinteger,min(1))"
s = m:section(TypedSection, "classify")
s.template = "cbi/tblsection"
local vid = s:option(Value, has_vlan4k or "vlan", "VLAN ID", "<div id='portstatus-%s'></div>" % switch_name)
+ local mx_vid = has_vlan4k and 4094 or (num_vlans - 1)
vid.rmempty = false
vid.forcewrite = true
vid.vlan_used = { }
+ vid.datatype = "and(uinteger,range("..min_vid..","..mx_vid.."))"
-- Validate user provided VLAN ID, make sure its within the bounds
-- allowed by the switch.