diff options
author | Ted Trask <ttrask01@yahoo.com> | 2015-05-20 15:51:39 -0400 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2015-05-20 15:51:39 -0400 |
commit | 2d8bd86c86846c1dc688fbe5039009102d7a74d3 (patch) | |
tree | 4cf1ad043f360c551f038d2ed0850fab8dffb169 | |
parent | ed7ac9ac047a56540dbc6a93a478e8c7bebd720b (diff) | |
download | acf-core-2d8bd86c86846c1dc688fbe5039009102d7a74d3.tar.bz2 acf-core-2d8bd86c86846c1dc688fbe5039009102d7a74d3.tar.xz |
htmlviewfunctions.lua fixes to properly display readonly checkbox and select
-rw-r--r-- | lib/htmlviewfunctions.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/htmlviewfunctions.lua b/lib/htmlviewfunctions.lua index a43bead..3c9f34e 100644 --- a/lib/htmlviewfunctions.lua +++ b/lib/htmlviewfunctions.lua @@ -213,6 +213,7 @@ function mymodule.displayformitem(myitem, name, header_level, group) elseif myitem.type == "boolean" then local tempval = myitem.value if (myitem.value == true) then myitem.checked = "" end + if (myitem.readonly == true) then myitem.disabled = true end myitem.value = "true" io.write(html.form.checkbox(myitem)) myitem.value = tempval @@ -222,7 +223,17 @@ function mymodule.displayformitem(myitem, name, header_level, group) io.write(html.form.longtext(myitem)) myitem.value = tempval elseif myitem.type == "select" and myitem.readonly then + local tempval = myitem.value + if myitem.option and myitem.option[1] and type(myitem.option[1]) == "table" then + for i,o in ipairs(myitem.option) do + if tempval == o.value then + myitem.value = o.label + break + end + end + end io.write((html.form.text(myitem) or "")) + myitem.value = tempval else io.write((html.form[myitem.type](myitem) or "")) end |