2014-10-03 47 views
2

我有一個循環查詢,我想要做的是顯示 「評級」中的值爲每個無線電值。如何在循環中默認無線電值?

轉儲值我GET(5,4.5,5,5) 所以我想默認在單選按鈕中的每個值。

我做了一個http://jsfiddle.net/yb9mxxu5/1/

我如何能夠用表來完成這個波紋管

<table> 
<thead> 
    <tr><th>1</th><th>2</th><th>3</th><th>4</th><th>question</th></tr> 
</thead> 
<tbody> 
<cfloop index="i" from="1" to="4"> 
    <cfset rating = Mush2["rating" & i][Mush2.CurrentRow]> 
    <cfset question = Mush2["csedept_question" & i][Mush2.CurrentRow]> 
    <tr> 
     <cfdump var=#rating#> 
     <td valign="top"> 
      <input type="radio" name="rating1#i#row#CurrentRow#" value="5"> 
     </td> 
     <td valign="top"> 
      <input type="radio" name="rating2#i#row#CurrentRow#" value="4.5"> 
     </td> 
     <td valign="top"><div align="center"> 
      <input type="radio" name="rating3#i#row#CurrentRow#" value="4"> 
     </td> 
     <td valign="top"> 
      <input type="radio" name="rating4#i#row#CurrentRow#" value="3.5"> 
     </td> 
     <cfif i is 1> 
      <td><strong>testing </strong><br/> 
       <span class="description">test</span> 
      </td> 
     </cfif> 
     <cfif i is 2> 
      <td><strong>testing</strong><br/> 
       <span class="description">test</span> 
      </td> 
     </cfif> 
     <cfif i is 3> 
      <td><strong>testing</strong><br/> 
       <span class="description">test</span> 
      </td> 
     </cfif> 
     <cfif i is 4> 
      <td><strong>testing</strong><br/> 
       <span class="description">test.</span> 
      </td> 
     </cfif> 
    </tr> 
</cfloop> 
</tbody> 
</table> 

回答

2

這應該工作

<cfloop list="#rating#" index="oneRating"> 
    <td valign="top"> 
     <div align="center"> 
     <input type="radio" name="rating1#i#row#CurrentRow#" value="#oneRating#"> 
     </div><br> 
    </td> 
</cfloop> 
相關問題