[eluser]MRosenello[/eluser]
This issue has been bugging me for quite a few days now. In IE I have a form that when submitted the first time does what expected; however if it wont't let me submit the same form again unless I close IE and reopen it. The second time I submit the form this line seems to be evaluating to false: $this->form_validation->run() == FALSE.
However, in chrome the form works fine every time. Anyone ever see this before, or know what may be causing it? Below is the function in the controller that seems to be giving the issues.
Also, I am quite new to CI. Any help is much appreciated.
Code:
function confirmOrder($items)
{
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('EID','EID','required');
//echo($this->form_validation->run());
$data['eid'] = $this->session->userdata('EID');
$data['contactPhone'] = $this->session->userdata('contactPhone');
$EID = $data['eid'];
$data['firstName'] = $this->session->userdata('firstName');
$data['lastName'] = $this->session->userdata('lastName');
$data['user'] = $this->session->userdata('lanID');
$data['domain'] = $this->session->userdata('domain');
$data['orderItems'] = $this->request_model->finishOrder($items);
$validations = $data['orderItems'];
for ($i=1;$i<=count($validations);$i++){
if(isset($validations[$i]['validation'])){
foreach($validations[$i]['validation'] as $validationID){
$id = $i."__".$validationID;
$this->form_validation->set_rules($id,$validationID,'required');
//echo($validationID);
}
}
}
//echo($validations[1]['validation'][1]);
$data['items'] = $items;
$orderConvert = $data['orderItems'];
$arrValues= array();
for($i=1;$i<= count($orderConvert);$i++)
{
array_push($arrValues,$orderConvert[$i]['name'].", ".$orderConvert[$i]['ID']);
//$orderDesc[$i] = $orderConvert[$i]['model'].", ".$orderConvert[$i]['part_no'];
}
$orderArray = $data['orderItems'];
if ($this->form_validation->run() == FALSE)
{
//echo("WHY IS IT FALSE");
//echo($this->form_validation->run());
$this->load->view('requestFinalize.php',$data);
}
else
{
//$arr2 = $this->input->post();
//print_r($arr2);
//print_r($this->input->post());
$formInputs = $this->input->post();
$count = $formInputs['itemCount'];
$values = array();
for($i=1;$i<=$count;$i++){
foreach($formInputs as $key => $value){
if (substr($key,0,1)==$i && substr($key,3) != "assignmentGroup")
{
$key = str_replace($i."__","",$key);
$key = str_replace("_"," ",$key);
array_push($values,"".$key." :".$value."\n");
}
$data['user'] = $this->session->userdata('lanID');
$data['domain'] = $this->session->userdata('domain');
$data['values'] = $formInputs;
//$data['IMnumber'] = $this->request_model->create_request($arrValues,$EID);
//$data['IMnumber'] = $this->request_model->create_dynamic_request($formInputs);
}
}
$formInputs['items'] = $items;
$this->session->set_userdata('currentCart', $formInputs);
$data['test'] = $this->session->userdata('currentCart');
//$this->session->unset_userdata('currentCart');
$this->load->view('requestConfirm.php',$data);
}
}