【发布时间】:2013-12-04 06:53:12
【问题描述】:
有了这个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>');
}
}
});
在这个默认提交按钮是存在的。
但我想添加“关闭”按钮。
或者我如何删除或隐藏默认的“提交”按钮,以便我添加其他提交和关闭按钮?
【问题讨论】:
-
考虑覆盖 jsonform 并在隐藏默认提交按钮时自己添加关闭按钮。
-
我认为添加自定义按钮的文档并不简单。 @eegloo 在下面查看我关于添加自定义按钮的答案。
-
@srvikram13 :感谢您的回答。 “.form-actions {display:none;}”添加到 CSS 文件中。这也有效
-
@Pedram Behroozi:是的,我有这个链接,谢谢。但有些部分并不直截了当。这就是为什么困惑。在 CSS 中添加了“.form-actions {display:none;}”。
标签: javascript jquery json jquery-ui getjson