如何验证标签数据

时间:2016-11-11 07:46:59

标签: javascript jquery

我是jquery的新手。我有一个问题。我想验证标签数据。确保用户从每个选项卡中选中复选框,即在图像中有三个选项卡(健身,健康和营养),因此用户必须从每个选项卡中选择至少一个复选框

enter image description here

这是我的HTML代码

<form class="form-horizontal" role="form" method="POST" action="{{ url('/fitness') }}" enctype="multipart/form-data">
            {{ csrf_field() }}
<div id="parentHorizontalTab">
    <ul class="resp-tabs-list hor_1 custom-tab-vertical">
        @foreach($fitnessdata as $allfitness)
        <li class="new">{{ $allfitness['name'] }}</li>
        @endforeach
        <!-- <div class="submit show-div">
            <div class="form-group">
                <label>Enter Your Title</label>
                <input type="text" class="form-control getdata" placeholder="Enter Own Category">
                    <button type="button" class="btn btn-info addCategory">Submit</button>
            </div>
        </div> -->
        <div class="add-more">
        <h6>OR</h6>
        <button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal">Add More</button>
        </div>
        <!-- <div class="add-more">
            <h6>OR</h6>
            <button type="button" class="btn btn-info add-more-show">Add</button>
        </div> -->
    </ul>
    <div class="resp-tabs-container hor_1 custom-vertical-tabs">
        @foreach($fitnessdata as $key=>$allfitness)
        <div>
            <p>
                <div class="ChildVerticalTab_1">
                    <ul class="resp-tabs-list ver_1 custom-tab-horizontal">
                       <li>Top Services</li>
                       <li>Popular Services</li>
                       <li>Choose Own Services</li>
                       <li>Special Offers</li>
                    </ul>
                    <div class="resp-tabs-container ver_1 custom-horizontal-tabs">
                        <div>
                            <div class="list-services">
                                <ul>
                                    @foreach($allfitness['fitness'] as $topservices)
                                    @if($topservices['type'] == 1)
                                    <li>
                                        <label>
                                           <input name="{{ $allfitness['name']}}[]" value="{{ $topservices['name']}}" type="checkbox"> 
                                           <span class="services-name">{{ $topservices['name']}}</span>
                                        </label>
                                    </li>
                                    @endif
                                    @endforeach
                                </ul>
                            </div>
                            <div class="total-number">
                             <h6>Total Services Selected</h6>
                             <span class="badge">0</span>
                            </div>
                        </div>
                        <div>
                            <div class="list-services">
                                <ul>
                                    @foreach($allfitness['fitness'] as $popular)
                                    @if($popular['type'] == 2)
                                    <li>
                                        <label>
                                            <input name="{{ $allfitness['name']}}[]" value="{{ $popular['name']}}"type="checkbox">
                                            <span class="services-name"> {{ $popular['name']}}</span> 
                                        </label>
                                    </li>
                                    @endif
                                    @endforeach
                                </ul>
                            </div>
                            <div class="total-number">
                                <h6>Total Services Selected</h6>
                                <span class="badge">0</span>
                            </div>
                        </div>
                        <div>
                        <div class="name-contain-id-<?php echo $key+1; ?>">
                              <div class="name-list">
                                <input type="text" name="{{ $allfitness['name']}}[]" class="form-control" />
                              </div>
                              <div class="sign-btn signup-page">
                                <a id="name-contain-id-<?php echo $key+1; ?>" class="btn btn-info sign-bttn">Add More</a>
                              </div>
                        </div>
                            <!-- <div class="list-services_add">
                                <div class="btn-save-class">
                                    <input type="text" name="{{ $allfitness['name']}}[]" class="form-control">
                                </div>
                                <div class="add-more">
                                    <button type="button" class="btn btn-info add-show">Add</button>
                                </div>
                            </div> -->
                            <!-- <div class="total-number">
                                <h6>Total Services Selected</h6>
                                <span class="badge">2</span>
                            </div> -->
                        </div>
                        <div>
                            <div class="list-services">
                                <ul>
                                    @foreach($allfitness['fitness'] as $special)
                                    @if($special['type'] == 3)
                                    <li>
                                        <label>
                                            <input type="checkbox"> 
                                                <span name="{{ $allfitness['name']}}[]" value="{{ $special['name']}}"class="services-name">{{ $special['name'] }}</span> 
                                        </label>
                                    </li>
                                    @endif
                                    @endforeach
                                </ul>
                            </div>
                            <div class="total-number">
                                <h6>Total Services Selected</h6>
                                <span class="badge">0</span>
                            </div>
                        </div>
                    </div>
                </div>
            </p>
        </div>
        @endforeach
    </div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
    <div class="btn-save-class">
        <button type="submit" class="btn btn-info">Save and Coutinue</button>
    </div>
</div>

0 个答案:

没有答案