php - Codeigniter Value Not Setting -


i having issue code , on submit selected value user_support_documentaries not being submitted array

i can view html source before page submit , shows value tag populated - cannot why selected item not being put array.

html:

<label>     <input type="radio" id="user_dafapp_1" name="user_dafapp" value="1" class="checkbox" <?php echo selected_checkbox(set_value('user_dafapp',$grant['user_dafapp']) == 1) ?> /> <br /> </label>      <div id="user_support_documentaries_container" style="display: none;">     <?php echo form_dropdown('user_support_documentaries', $film_list, set_value('user_support_documentaries',$grant['user_support_documentaries']), 'id="user_support_documentaries"'); ?> </div> 

js:

// checkout form enhancement     if ($("#user_dafapp_1").is(":checked")) // if checked     {         $("#user_support_documentaries_container").show("fast"); //show hidden div     }     else     {         $("#user_support_documentaries_container").hide("fast"); //otherwise, hide     }     $("input[name*='user_dafapp']").click(function ()     {         if ($("#user_dafapp_1").is(":checked"))         {             $("#user_support_documentaries_container").show("fast");         }         else         {             $("#user_support_documentaries_container").hide("fast");         }      }); 

controller:

function op($action = null, $grant_id = null)     {         if ($this->session->userdata('user_role') != 'grantmaker')         {             redirect('grants');         }          $user_id = $this->session->userdata('user_id');          $results = $this->users_model->get_user_by_id($user_id);         $this->data['user'] = $results->row_array();          switch ($action) {              case "edit" :                  $results = $this->grant_model->get($grant_id, $user_id);                  if ($results->num_rows() == 0)                 {                     $this->session->set_flashdata('flash', 'grant not found', 'error');                     redirect('user/my_grants');                 }                  $grant = $results->row_array();                  $this->data['submit_text'] = 'save changes';                  $page_title = 'edit grant';             break;              case "add" :                  $grant = array(                                 'user_budget'                   => '',                                 'user_dafapp'                   => '',                                 'user_support_documentaries'    => '',                                 'related_filmmakers'            => '',                                 'user_related_filmmakers'       => '',                                 'user_anoymous'                 => '',                             );                  $this->data['submit_text'] = 'submit';                 $page_title = 'make grant application form';             break;             default :                  $this->session->set_flashdata('flash', 'grant not found', 'error');                 redirect('user/my_grants');              break;          }          $this->data['action'] = $action;         $this->form_validation->set_rules('user_budget','budget','required|numeric|trim|xss_clean'); //amount         $this->form_validation->set_rules('user_dafapp','support','trim|xss_clean'); //support         $this->form_validation->set_rules('user_support_documentaries','support documentaries','trim|xss_clean'); //films          $this->form_validation->set_error_delimiters('<span class="error">', '</span>');          if ($this->form_validation->run() == false)         {                $this->data['grant'] = $grant;              $this->data['grant_id'] = $grant_id;              $this->data['film_list'] = $this->film_model->get_select_options2();              build_page('user/my_grants/grant/op/add_edit_form', $this->data, $page_title, 'user');         }         else         {             $grant_data['user_budget']                  = set_value('user_budget'); //amount             $grant_data['user_dafapp']                  = set_value('user_dafapp'); //support             $grant_data['user_support_documentaries']   = ((set_value('user_dafapp') == 1) ? set_value('user_support_documentaries') : ''); //this line                switch($action)              {                 case('edit'):                      $grant_data['grant_modified'] = date('y-m-d h:i:s');                      if ($this->grant_model->save($grant_data, 'edit', $grant_id) == true)                     {                         $this->session->set_flashdata('flash', 'grant updated', 'success');                     }                  break;                  case('add'):                      $grant_data['grant_created']    = date('y-m-d h:i:s');                     $grant_data['user_id']  = $user_id;                     $grant_data['grant_active'] = 0;                      if ($this->grant_model->save($grant_data, 'add', $grant_id) == false)                      {                         log_message('error', "failed add grant {$grant_id} via admin section");                         $this->session->set_flashdata('flash', 'failed add grant - '.set_value('grant_name'), 'error');                     }                     else                     {                         $responder_array = array(                             '%user_budget'                  => set_value('user_budget'),                             '%user_dafapp'                  => ((set_value('user_dafapp') == 1) ? 'support 1 or more documentaries on name approved list of films' : 'support general operations of name'),                             '%user_support_documentaries'   => ((set_value('user_dafapp') == 1) ? set_value('user_support_documentaries') : '')                             );                          /*                                                 $responder_array = array(                             '%user_budget'                  => set_value('user_budget'),                             '%user_dafapp'                  => ((set_value('user_dafapp') == 2) ? 'support 1 or more documentaries on name approved list of films' : 'support general operations of name'),                             '%user_support_documentaries'   => ((set_value('user_dafapp') == 2) ? set_value('user_support_documentaries') : ''),                             '%user_related_filmmakers'      => ((set_value('related_filmmakers')) ? set_value('user_related_filmmakers') : ''),                             '%user_anoymous'                => ((set_value('user_anoymous')) ? 'yes' : 'no'),                             );                             */                         @$this->autoresponder->send('add_grant', $this->session->userdata('user_email'), $this->session->userdata('user_first_name') . " ". $this->session->userdata('user_surname'), $responder_array);                         @$this->autoresponder->send('add_grant', notification_email, null, $responder_array);                          $this->session->set_flashdata('flash', 'your grant submission successful', 'success');                     }                  break;             }              redirect("user/my_grants");                  }     } 

try replacing

$("#user_dafapp_1").is(":checked") 

with

$("#user_dafapp_1").attr("checked") 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -