2016-09-18 53 views
0

我正在使用物化css進行設計,我一直在想爲什麼我的單選按鈕不工作 - 不工作,我的意思是它不可點擊。物化按鈕在Laravel中不工作

但是,如果收音機在foreach($segments as $segment)之內,但如果放在收音機之外,單選按鈕工作得很好。

我無法理解我出錯的地方。從那以後,我一直被困在這裏。如果你能幫助,這將是非常高興的!提前致謝!

@foreach($segments as $segment) 
     @foreach($collars as $collar) 
     @if($collar->boolIsActive == 1) 
     <div class="col s12" style="margin-top:20px;"> 
     <ul class="collapsible" data-collapsible="accordion" style="border:none;" @if($segment->strSegmentID != $collar->strSegmentFK) hidden @endif> 
      <li> 
      <div class="collapsible-header" style="background-color:#00838f; color:white; height:30px; padding-top:10px; padding-bottom:50px; font-size:18px">{{ $collar->strSegStyleName }}</div> 
      <div class="collapsible-body row overflow-x" style="padding:20px;"> 
       <div class="col s12"> 
       @foreach($patterns as $pattern) 
       <div class="col s2" @if($pattern->strSegPStyleCategoryFK != $collar->strSegStyleCatID) hidden @endif> 
        <img class="materialboxed responsive-img" src="{{URL::asset($pattern->strSegPImage)}}"> 
        <p> 
        <input name="rdb_pattern" type="radio" class="filled-in" id="{{$pattern->strSegPatternID}}" /> 
        <label for="{{$pattern->strSegPatternID}}">{{$pattern->strSegPName}}</label> 
        </p> 
       </div> 
       @endforeach 
       </div>     
      </div> 
      </li> 
     </ul> 
     </div> 
     @endif 
     @endforeach 
     @endforeach 
+0

您是否檢查過在循環中生成的單選按鈕是否具有不同的ID? –

回答

0

我終於想通了!這就是我所做的。

@foreach($segments as $i => $segment) 
     @foreach($collars as $j => $collar) 
     @if($collar->boolIsActive == 1) 
     <div class="col s12" style="margin-top:20px;"> 
     <ul class="collapsible" data-collapsible="accordion" style="border:none;" @if($segment->strSegmentID != $collar->strSegmentFK) hidden @endif> 
      <li> 
      <div class="collapsible-header" style="background-color:#00838f; color:white; height:30px; padding-top:10px; padding-bottom:50px; font-size:18px">{{ $collar->strSegStyleName }}</div> 
      <div class="collapsible-body row overflow-x" style="padding:20px;"> 
       <div class="col s12"> 
       @foreach($patterns as $k => $pattern) 
       <div class="col s2" @if($pattern->strSegPStyleCategoryFK != $collar->strSegStyleCatID) hidden @endif> 
        <img class="materialboxed responsive-img" src="{{URL::asset($pattern->strSegPImage)}}"> 
        <p> 
        <input name="rdb_pattern{{ $collar->strSegStyleCatID }} {{ $i+1 }}" type="radio" class="filled-in" id="{{$pattern->strSegPatternID}}{{ $i+1 }}{{ $j+1 }}{{ $k+1 }}" /> 
        <label for="{{$pattern->strSegPatternID}}{{ $i+1 }}{{ $j+1 }}{{ $k+1 }}">{{$pattern->strSegPName}}</label> 
        </p> 
       </div> 
       @endforeach 
       </div>     
      </div> 
      </li> 
     </ul> 
     </div> 
     @endif 
     @endforeach 
     @endforeach