Welcome! Here you can paste sources and general debugging text, You can even set yourself a password if you want to keep it just for yourself.

Posted by codigo on March Sun 2nd 8:34 PM - Never Expires - Views: 401

  1. /*view*/
  2.  
  3. <div class="btn-group" data-toggle-name="is_private" data-toggle="buttons">
  4.        
  5.         <button type="button" class="btn btn-primary active" value="1dia">
  6.           <input type="radio" name="button-1dia" id="button-1dia">1 Dia</input>
  7.         </button>
  8.         <label class="btn btn-primary">
  9.           <input type="radio" value="2dias" name="button-2dias" id="button-2dias">2 Dias</input>
  10.         </label>
  11.         <label class="btn btn-primary">
  12.           <input type="radio" value="3dias" name="button-3dias" id="button-3dias">3 Dias</input>
  13.         </label>
  14.         <label class="btn btn-primary">
  15.           <input type="radio" value="7dias" name="button-7dias" id="button-7dias">7 Dias</input>
  16.         </label>
  17.         <label class="btn btn-primary">
  18.           <input type="radio" value="1mes" name="button-1mes" id="button-1mes">1 MÍs</input>
  19.         </label>
  20.       </div>
  21.  
  22.       <input type="hidden" name="is_private" id="is_private" value="1dia" />
  23.  
  24. <!-- Single button -->
  25.       <div class="btn-group">
  26.         <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
  27.           Categoria <span class="caret"></span>
  28.         </button>
  29.  
  30.         <ul class="dropdown-menu" role="menu">
  31.           <?php
  32.            foreach ($categorias as $value_options) {
  33.              echo '<li><a href="categoria/procurar/'.strtolower($value_options->nome).'">'.$value_options->nome.'</a></li>';
  34.             }
  35.           ?>
  36.           <!-- <li><a href="#">Action</a></li>
  37.          <li><a href="#">Another action</a></li>
  38.          <li><a href="#">Something else here</a></li>
  39.          <li class="divider"></li>
  40.          <li><a href="#">Separated link</a></li> -->
  41.         </ul>
  42.  
  43.       </div>
  44.  
  45. /*jquery dentro dessa view*/
  46. <script type="text/javascript">
  47.  
  48. $(function(){
  49.  
  50.   $('div.btn-group[data-toggle-name=is_private]').each(function() {
  51.     console.log("teste");
  52.     var group   = $(this);
  53.     //var form    = group.parents('form').eq(0);
  54.     var name    = group.attr('data-toggle-name');
  55.     var hidden  = $('input[name="is_private"]');
  56.     //alert(hidden);
  57.     $('button', group).each(function(){
  58.       console.log("teste2");
  59.       var button = $(this);
  60.       button.on('click', function(){
  61.         console.log("teste3");
  62.         hidden.val($(this).val());
  63.         alert(hidden.val());
  64.         alert($(this).val());
  65.         //$('button[name="rating"].active').val();
  66.       });
  67.       //if(button.val() == hidden.val()) {
  68.       //  button.addClass('active');
  69.       //}
  70.     });
  71.   });
  72.  
  73.  
  74. });
  75.  
  76.  
  77. /*controller categoria*/
  78. public function procurar($categoria = null) {
  79.                
  80.                 //$active = 1;
  81.  
  82.                 //$destaque = 1
  83.  
  84.                 $dias = $this->input->post('is_private');
  85.  
  86.                 //var_dump($dias);
  87.  
  88.                 $post = array();
  89.                 foreach ( $_POST as $key => $value )
  90.                 {
  91.                     $post[$key] = $this->input->post($key);
  92.                 }
  93.                 var_dump($post);
  94. }
Language:
To highlight particular lines, prefix each line with @@




© 2017  YSblue.com.br (Implemented and Adapted) - Powered by PASTE 1.0