Commit 4c9bd4d0 authored by Ted Trask's avatar Ted Trask

When creating new database entry, set all values to default

parent dad7e05c
......@@ -160,7 +160,7 @@ function mymodule.get_new_table_entry(dbase, self, clientdata)
retval.value.nulls.value[f] = cfe({ type="boolean", value=false, label=f, seq=i })
end
if defaults[f] then
retval.value.defaults.value[f] = cfe({ type="boolean", value=false, label=f, default=defaults[f], seq=i })
retval.value.defaults.value[f] = cfe({ type="boolean", value=true, label=f, default=defaults[f], seq=i })
end
end
end
......@@ -193,6 +193,13 @@ function mymodule.get_table_entry(dbase, self, clientdata)
end
local retval = mymodule.get_new_table_entry(db, self, clientdata)
if retval.value.fields and retval.value.defaults then
for n,v in pairs(retval.value.fields.value) do
if retval.value.defaults.value[n] then
retval.value.defaults.value[n].value = false
end
end
end
self.handle_clientdata(retval, clientdata) -- Fill in the fields
if not retval.value.connection.errtxt and not retval.value.table.errtxt and retval.value.fields then
local res, err = pcall(function()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment