2010-01-08 96 views
0

我有一個表單域/複選框,即使選中它也無法傳遞布爾值。無法傳遞布爾值

<input type="checkbox" name="IsContactValid" 
       id=" IsContactValid" 
        <cfif       
         ContactView.GetIsContactValid()>CHECKED 
     </cfif>> 
that will be transmitted to the receiving form if the box is checked. 

請幫忙。

回答

7

你可以給複選框的值:

<input type="checkbox" name="IsContactValid" value="1" 
       id=" IsContactValid" 
        <cfif       
         ContactView.GetIsContactValid()>CHECKED 
     </cfif>> 

如果複選框被選中,將被髮送到接收的形式。

+1

'checked =「checked」'對於更新的HTML標準更有效。 – ale 2010-01-08 19:10:50

+0

我不會說「更有效」。本身檢查是適用於HTML 4.01和5. – Henry 2010-01-08 19:32:58

+0

是的,但在這種情況下CHECKED自己沒有工作。 – vas 2010-01-08 20:05:31