summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-11-03 17:05:41 +0000
committerTed Trask <ttrask01@yahoo.com>2014-11-03 17:05:41 +0000
commitd0ce28f1669342c00922c378f82824ba503c338f (patch)
treefc1a278e37042ba6a612cc8b1c5cea3fd37597b4
parent77544fd417fd9c8095306a4594afb9524d218b25 (diff)
downloadacf-db-d0ce28f1669342c00922c378f82824ba503c338f.tar.bz2
acf-db-d0ce28f1669342c00922c378f82824ba503c338f.tar.xz
Add js to HTML views to disable other fields when null or default is checked
-rw-r--r--lib/db-createtableentry-html.lsp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/db-createtableentry-html.lsp b/lib/db-createtableentry-html.lsp
index 29fe7b0..f9a2456 100644
--- a/lib/db-createtableentry-html.lsp
+++ b/lib/db-createtableentry-html.lsp
@@ -2,6 +2,28 @@
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>
+<script type="text/javascript">
+ if (typeof jQuery == 'undefined') {
+ document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
+ }
+</script>
+
+<script type="text/javascript">
+ function checkboxChanged(){
+ if ($(this).is(':checked')) {
+ $(this).siblings(":input").prop('disabled', true);
+ } else {
+ $(this).siblings(":input").prop('disabled', false);
+ }
+ }
+ $(document).ready(function() {
+ $(".nulls:checked").each(checkboxChanged);
+ $(".defaults:checked").each(checkboxChanged);
+ $(".nulls").change(checkboxChanged);
+ $(".defaults").change(checkboxChanged);
+ });
+</script>
+
<%
local header_level = htmlviewfunctions.displaysectionstart(form, page_info)
local header_level2 = htmlviewfunctions.incrementheader(header_level)
@@ -37,10 +59,12 @@ for x,name in ipairs(order) do
htmlviewfunctions.displayformitem(myitem, name, -1, "fields")
if not myitem.readonly and form.value.defaults and form.value.defaults.value[name] then
form.value.defaults.value[name].descr = "Default"
+ form.value.defaults.value[name].class = "defaults"
htmlviewfunctions.displayformitem(form.value.defaults.value[name], name, -1, "defaults")
end
if not myitem.readonly and form.value.nulls and form.value.nulls.value[name] then
form.value.nulls.value[name].descr = "Null"
+ form.value.nulls.value[name].class = "nulls"
htmlviewfunctions.displayformitem(form.value.nulls.value[name], name, -1, "nulls")
end
htmlviewfunctions.displayitemend(myitem, nil, header_level2)