0

我有一个使用 Janko At Warpseeds Form to Wizard Plugin 和ImagePicker 插件的表单,我想确保在单击 Next 之前选择所有图像。

我目前正在使用 Bassassistance 验证插件。

有谁知道我该如何实现这个?

JSFiddle 在此处显示当前工作代码和所有 javascript http://jsfiddle.net/4Hkxy/

    $(function () {
       jQuery(function($){
            var $signupForm = $( '#multipage' );
 $signupForm.formToWizard({
                submitButton: 'SaveAccount',
                showProgress: true, //default value for showProgress is also true
                nextBtnName: 'Forward >>',
                prevBtnName: '<< Previous',
                showStepNo: false,
                validateBeforeNext: function() {
                    var selectedCount = $('.thumbnails.image_picker_selector:visible .selected').length;
    var totalCount = $('.thumbnails.image_picker_selector:visible').length;

    if(selectedCount != totalCount) {
        alert('please select an image per selection');
    }
                }
            });
});

    $("select.image-picker").imagepicker({
        hide_select: true,
        show_label: true,
    });
    $("select.image-picker.show-labels").imagepicker({
        hide_select: true,
        show_label: true,
    });

    var container = $("select.image-picker.masonry").next("ul.thumbnails");
    container.imagesLoaded(function () {
        container.masonry({
            itemSelector: "li",
        });
    });

任何帮助,将不胜感激。

4

1 回答 1

0

尝试这个:

    //inside "next.onclick" handler
    var selectedCount = $('.thumbnails.image_picker_selector:visible .selected').length;
    var totalCount = $('.thumbnails.image_picker_selector:visible').length;

    if(selectedCount != totalCount) {
        alert('please select an image per selection');
    }
于 2013-06-03T13:57:27.920 回答