jbe@56: --[[-- jbe@56: ui.field.file{ jbe@56: ... -- generic ui.field.* arguments, as described for ui.autofield{...} jbe@56: } jbe@56: jbe@56: This function inserts a field for uploading a file 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{...}. jbe@56: jbe@56: --]]-- jbe@56: jbe@56: function ui.field.file(args) jbe@56: ui.form_element(args, nil, function(args) jbe@56: if args.readonly then jbe@56: -- nothing jbe@56: else jbe@56: if not slot.get_state_table().form_file_upload then jbe@56: error('Parameter "file_upload" of ui.form{...} must be set to true to allow file uploads.') jbe@56: end jbe@56: local attr = table.new(args.attr) jbe@56: attr.type = "file" jbe@56: attr.name = args.html_name jbe@56: ui.tag{ tag = "input", attr = attr } jbe@56: end jbe@56: end) jbe@56: end