使用这个https://github.com/joshfire/jsonform,我创建了表单。
$('form').jsonForm({
schema: {
name: {type: 'string', title: 'Name', required: true},
//age: {type: 'number', title: 'Age', required: true},
comment: {type: 'textarea', title: 'Comments', required: true},
choice: {type: 'string',title: 'Title', 'enum': ['choice-1','choice-2','choice-3']},
},
onSubmit: function (errors, values) {
if (errors) {
$('#res').html('<p>I beg your pardon?</p>');
}
else {
$('#res').html('<p>Hello ' + values.name + '.' +
(values.comment ? '<br/>You are ' + values.comment + '.' : '') +
'</p>');
}
}
}); 在这种情况下,默认情况下存在提交按钮。
但是我想添加“关闭”按钮。
或者我如何删除或隐藏默认的“提交”按钮,以便添加其他提交和关闭按钮?
发布于 2013-12-04 07:27:51
$('form').jsonForm({
...code
});
// Save reference to parent element to append custom buttons
var btn-container = $('form input[type=submit]').parent();
// Remove default 'submit' button
$('form input[type=submit]').remove();
// now add custom buttons in btn-containerhttps://stackoverflow.com/questions/20368945
复制相似问题