vendredi 19 février 2016

Yii dynamic checkbox

I have a column in my table named 'availability_option' with type enum('0', '1', '2'). Zero means 'Fixed Price', One means 'Auction', Two means 'Both'. I want to generate 2 checkboxes dynamically One for Fixed Price and another 'Auction'. How is it possible? I didi it static. But it should not be the right syntax of yii.

<input value="0" id="fixedprice" type="checkbox" name="ProductShop[availability_option][]">
<label for="fixedprice">Fixed Price</label>
<input value="1" id="auctionprice" type="checkbox" name="ProductShop[availability_option][]">
<label for="auctionprice">Auction</label>

I want it dynamically, So how is it possible?Any idea?




Aucun commentaire:

Enregistrer un commentaire