Rev 17471 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<script>$(document).ready(function() {var max_fields = 10; //maximum input boxes allowedvar wrapper = $(".input_fields_wrap"); //Fields wrappervar add_button = $(".add_field_button"); //Add button IDvar x = 1; //initlal text box count$(add_button).click(function(e){ //on add input button clicke.preventDefault();if(x < max_fields){ //max input box allowedx++; //text box increment$(wrapper).append('<div><b>Category</b> <select name="data[FeaturedDeal][cat_rank][]"><option value="Mobile">Mobile</option><option value="Tablet">Tablet</option><option value="Accessories">Accessories</option></select><br><input type="text" name="data[FeaturedDeal][myrank][]"/><a href="#" class="remove_field">Remove</a></div>'); //add input box}});$(wrapper).on("click",".remove_field", function(e){ //user click on remove texte.preventDefault(); $(this).parent('div').remove(); x--;})});</script><div class="container"><div class="row"><div class="col-lg-3"><?php echo $this->Element('adminactions');?></div><div class="col-lg-9"><?php echo $this->Form->create('FeaturedDeal'); ?><fieldset><legend><?php echo __('Add Featured Deal'); ?></legend><?phpecho $this->Form->input('skuBundleId',array('type'=>'number'));//echo $this->Form->input('FeaturedDeal.rankDetails.0',array('type'=>'number','label'=>'Default Rank'));//$options = array(// '3' => 'Mobiles',// '5' => 'Tablets'//);// $attributes = array(// 'legend' => false,// 'value' => 3,// 'class' => 'catselect'// );// echo $this->Form->radio('type',$options,$attributes);// // echo $this->Form->input('FeaturedDeal.rankDetails',array('type'=>'number','label'=>'Rank','class'=>'categoryRank'));// echo $this->Form->input('FeaturedDeal.rankDetails.3',array('type'=>'number','label'=>'Mobiles Rank','class' => 'categoryRank'));// echo $this->Form->input('FeaturedDeal.rankDetails.5',array('type'=>'number','label'=>'Tablets Rank','class'=>'categoryRank','disabled'=>true));echo $this->Form->input('startDate',array('type'=>'datetime','timeFormat'=>24));echo $this->Form->input('endDate',array('type'=>'datetime','timeFormat'=>24));echo $this->Form->input('thresholdPrice',array('type'=>'number'));echo $this->Form->input('Mobiles',array('type'=>'number','value'=>0));echo $this->Form->input('Tablets',array('type'=>'number','value'=>0));echo $this->Form->input('Accessories',array('type'=>'number','value'=>0));// echo $this->Form->input('multi',array('type'=>'checkbox'));?><div class="input_fields_wrap"><button class="add_field_button">Add More Fields</button></div></fieldset><?php echo $this->Form->end(__('Submit')); ?></div></div></div></div><script type="text/javascript">$(function(){$(document).on('click','.catselect',function(){var that = $(this);$('.categoryRank').prop('disabled',true).val('');$('#FeaturedDealRankDetails'+$(this).val()).prop('disabled',false);})})</script>