我的多步骤表单未经过验证

时间:2016-10-02 11:01:39

标签: javascript twitter-bootstrap validation twitter-bootstrap-3

我正在尝试使用bootstrap验证方法验证我的多步骤表单,但面临一个奇怪的错误

@Autowired
private AmazonDynamoDBClient dynamoDBClient;

我用Google搜索了很多次,但找不到可以解决我的问题的解决方案。

实际上错误在哪里?

的script.js

 Uncaught Error: One or more corresponding step titles are missing.

HTML

$(document).ready(function () {
    function adjustIframeHeight() {
        var $body   = $('body'),
            $iframe = $body.data('iframe.fv');
        if ($iframe) {
            // Adjust the height of iframe
            $iframe.height($body.height());
        }
    }
    $("#profile_form").steps({
        headerTag: "h4",
        bodyTag: "fieldset",
        saveState: true,
        onStepChanged: function(e, currentIndex, priorIndex) {
                // You don't need to care about it
                // It is for the specific demo
                adjustIframeHeight();
            },
            // Triggered when clicking the Previous/Next buttons
            onStepChanging: function(e, currentIndex, newIndex) {
                var fv         = $('#profile_form').data('formValidation'), // FormValidation instance
                    // The current step container
                    $container = $('#profile_form').find('fieldset[data-step="' + currentIndex +'"]');

                // Validate the container
                fv.validateContainer($container);

                var isValidStep = fv.isValidContainer($container);
                if (isValidStep === false || isValidStep === null) {
                    // Do not jump to the next step
                    return false;
                }

                return true;
            },
            // Triggered when clicking the Finish button
            onFinishing: function(e, currentIndex) {
                var fv         = $('#profile_form').data('formValidation'),
                    $container = $('#profile_form').find('fieldset[data-step="' + currentIndex +'"]');

                // Validate the last step container
                fv.validateContainer($container);

                var isValidStep = fv.isValidContainer($container);
                if (isValidStep === false || isValidStep === null) {
                    return false;
                }

                return true;
            },
            onFinished: function(e, currentIndex) {
                // Uncomment the following line to submit the form using the defaultSubmit() method
                //$('#multiphase').formValidation('defaultSubmit');

                // For testing purpose
              //  $('#welcomeModal').modal("show");
            }
        }).formValidation({
        excluded: ':disabled',
        message: 'This value is not valid',
        container: 'tooltip',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {..................}
......................

>

1 个答案:

答案 0 :(得分:0)

您是否尝试将title属性添加到州定义中?

$("#profile_form").steps({
    headerTag: "h4",
    title: "profile details".
    bodyTag: "fieldset",
    saveState: true...