webmcp

diff framework/env/ui/field/password.lua @ 0:9fdfb27f8e67

Version 1.0.0
author jbe/bsw
date Sun Oct 25 12:00:00 2009 +0100 (2009-10-25)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/framework/env/ui/field/password.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +--[[--
     1.5 +ui.field.password{
     1.6 +  ...                        -- generic ui.field.* arguments, as described for ui.autofield{...}
     1.7 +}
     1.8 +
     1.9 +This function inserts a field for a password in the active slot. For read-only forms this function does nothing. For description of the generic field helper arguments, see help for ui.autofield{...}.
    1.10 +
    1.11 +--]]--
    1.12 +
    1.13 +function ui.field.password(args)
    1.14 +  ui.form_element(args, {fetch_value = true}, function(args)
    1.15 +    local value_string = atom.dump(args.value)
    1.16 +    if args.readonly then
    1.17 +      -- nothing
    1.18 +    else
    1.19 +      local attr = table.new(args.attr)
    1.20 +      attr.type  = "password"
    1.21 +      attr.name  = args.html_name
    1.22 +      attr.value = value_string
    1.23 +      ui.tag{ tag  = "input", attr = attr }
    1.24 +    end
    1.25 +  end)
    1.26 +end

Impressum / About Us