使用 Alpacajs 从一个表单导航到另一个表单



我有一个表单,下一个按钮。单击此下一个按钮后,它应导航到其他表单。

我创建了两个表单,但无法链接它们。

$("#field1").alpaca({
    "schema": {
        "title": "Name Info",
        "type": "object",
        "properties": {
            "firstName": {
                "title": "First Name",
                "type": "string"
            },
            "lastName": {
                "title": "Last Name",
                "type": "string"
            }
        }
    },
    "options": {
        "form": {
            "buttons": {
                "next": {
                    "click": function() {}
                }
            }
        }
    }
});

您是否尝试过使用威世智,我认为这可能会对您有所帮助。告诉我,如果这不是你要找的,我会尽力帮助你。

@smileisbest和@Shabbir-Dhangot,我在同一页面中实现了两种形式。 使用 JSON 库序列化数据并发送到下一个表单:

"click" : function() {
var editJsonData = JSON.stringify(this.getValue(), null, "  ");
doNext(editJsonData);
}

然后将对下一个窗体的调用作为函数添加:

// If JSON data is not null, the next form will display.
var doNext = function(jsonData) {
    $("#NextForm").empty();
    if (null != jsonData) {
        // Validate user or data...
        // This starts the Editor form
        $("#NextForm").alpaca({
"data" : jsonData,
"schema" : {
"type" : "object",
"properties" : { ...

适当地使用显示/隐藏来隐藏先前的表单:

$("#field1").hide();
$("#NextForm").show();

相关内容

最新更新