From c3d41e6cba0d8cb9ac3e1cf31573279284839183 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 6 Sep 2008 22:42:55 +0000 Subject: [PATCH] * luci-0.8: merge cbi error handling fixes --- libs/cbi/luasrc/cbi.lua | 14 ++++++++++++-- libs/cbi/luasrc/view/cbi/cell_valueheader.htm | 2 +- libs/cbi/luasrc/view/cbi/full_valueheader.htm | 2 +- libs/cbi/luasrc/view/cbi/tblsection.htm | 4 +++- libs/cbi/luasrc/view/cbi/ucisection.htm | 4 ++-- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index be591a80e..57147b63c 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -89,7 +89,11 @@ local function _uvl_validate_section(node, name) local function tag_fields(e) if e.option and node.fields[e.option] then - node.fields[e.option].error = e + if node.fields[e.option].error then + node.fields[e.option].error[name] = e + else + node.fields[e.option].error = { [name] = e } + end elseif e.childs then for _, c in ipairs(e.childs) do tag_fields(c) end end @@ -104,7 +108,13 @@ local function _uvl_validate_section(node, name) table.insert( s, c:string() ) end end - if #s > 0 then node.error = s end + if #s > 0 then + if node.error then + node.error[name] = s + else + node.error = { [name] = s } + end + end end local stat, err = node.map.validator:validate_section(node.config, name, co) diff --git a/libs/cbi/luasrc/view/cbi/cell_valueheader.htm b/libs/cbi/luasrc/view/cbi/cell_valueheader.htm index 9a065a3da..dda17463c 100644 --- a/libs/cbi/luasrc/view/cbi/cell_valueheader.htm +++ b/libs/cbi/luasrc/view/cbi/cell_valueheader.htm @@ -13,4 +13,4 @@ $Id$ -%> -"> +"> diff --git a/libs/cbi/luasrc/view/cbi/full_valueheader.htm b/libs/cbi/luasrc/view/cbi/full_valueheader.htm index fed2412f0..cbeda755b 100644 --- a/libs/cbi/luasrc/view/cbi/full_valueheader.htm +++ b/libs/cbi/luasrc/view/cbi/full_valueheader.htm @@ -13,7 +13,7 @@ $Id$ -%> -
"> +