0

フォームが大きいのでスライドフォームを使っています

http://tympanus.net/Tutorials/FancySlidingForm/

しかし、ステップ1で必須フィールドが空の場合、ステップ1からステップ2へのスライドを停止する必要があります

そのために私はこのように機能を変更しました

    function validateStep(step) {
            if (step == fieldsetCount) return;

            var error = 1;
            var hasError = false;
            $('#formElem').children(':nth-child(' + parseInt(step) + ')').find(':input:not(button)').each(function () {
                var $this = $(this);
                var valueLength = jQuery.trim($this.val()).length;

                if (valueLength == '') {
                    hasError = true;
                    $this.css('border-color', '#f8bcc2')
// here i added one function 
                    $('#steps').each(function () {
                        //   alert('hhh');
                        marginLeft: '0' + 'px'

                    }
                        );

                    //                $('#steps').css('margin-Left', '0')
                }
                else
                    $this.css('border-color', '#8DC440');
            });

よろしくお願いします...解決策があれば

4

1 に答える 1

0

チェックをクリックすると:

[...].click(function(ev){
  var _this=$(this), i = $(this).index(), valid;
  var set=$("#steps formset").get(index-1);
  valid=// Here check set all mandatory field is not empty
  if(valid) $("#steps formset").get(index)/*slide*/
});

必須フィールドを認識する「必須」クラスを追加します。

于 2012-05-02T12:02:22.020 に答える