简体   繁体   English

如何创建多步表单

[英]How to create Multi step form

We want to give option to author to create multi steps tabs or wizard.我们希望为作者提供创建多步骤选项卡或向导的选项。 This number of steps/tabs should be configurable in Form Start component in Edit button.这个步骤/选项卡的数量应该在“编辑”按钮的“表单启动”组件中进行配置。 Once author selects the number of steps/tabs then steps/tabs will be created automatically and then author can drag and drop other components like "File Upload", etc.. Please refer to the attached screenshot.一旦作者选择了步骤/选项卡的数量,将自动创建步骤/选项卡,然后作者可以拖放其他组件,如“文件上传”等。请参阅附件截图。

Kindly let me know how to proceed on this.请让我知道如何进行。在此处输入图片说明

You can try to leverage the OOTB tabctrl component provided in geometrixx-outdoors along with the OOTB form component.您可以尝试利用 geometrixx-outdoors 中提供的 OOTB tabctrl组件以及 OOTB 表单组件。 The only customization needed would be changing the form end component to accomodate prev and next buttons, and then adding a bit of javascript to navigate the tabs on click of those buttons.唯一需要的自定义是更改表单结束组件以容纳上一个和下一个按钮,然后添加一些 javascript 以在单击这些按钮时导航选项卡。

在此处输入图片说明

Steps to create this.创建此的步骤。

  • Drag and drop the default form component on page.将默认表单组件拖放到页面上。
  • Inside the form drag and drop the tab control component.在表单内拖放选项卡控件组件。
  • Configure the number of tabs required and the contents within each tab in the tab control component.在选项卡控件组件中配置所需选项卡的数量和每个选项卡内的内容。
  • Modify the form end component to accomodate the previous and next buttons.修改表单结束组件以容纳上一个和下一个按钮。
  • Attach handlers for the previous and next buttons using the following JS(currently consists only of the basic functionality. Can be modified according to your requirements).使用以下 JS 附加上一个和下一个按钮的处理程序(目前仅包含基本功能。可以根据您的要求进行修改)。

JS: JS:

jQuery(function ($) {
    $(document).on('click', '.prev', function(){ // 'prev' is class of previous button
        var tabctrl = $(this).closest('form').find('.tabctrl');
        var currentItemHeader = $(tabctrl).find(".tabctrl-header li.active");
        $(currentItemHeader).prev().find('a').click();
    });
    $(document).on('click', '.next', function(){ // 'next' is class of next button
        var tabctrl = $(this).closest('form').find('.tabctrl');
        var currentItemHeader = $(tabctrl).find(".tabctrl-header li.active");
        $(currentItemHeader).next().find('a').click();
    });
});

NOTE: Try to include the appropriate clientlibs in geometrixx site before testing this, else tabctrl wouldn't work properly.注意:在测试之前尝试在 geometrixx 站点中包含适当的 clientlibs,否则 tabctrl 将无法正常工作。 Or else, you can check this dierctly in geometrixx-outdoors site.或者,您可以在 geometrixx-outdoors 站点中直接查看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM