[eluser]valarkin[/eluser]
I am working on a reservation tool and am having problems with the validation. When I validate the information it fails and calls the load view method. However, none of the fields populate, nor does the error message populate.If I echo the error field before loading the view I can see all the errors.
Any ideas what might be causing this?
Here is some code of the code:
(Controller Function that handles Validation)
Code:
function _validateBirthdayReservation() {
$rules['conFirstName'] = "trim|required";
$rules['conLastName'] = "required";
$rules['conAddress'] = "required";
$rules['conCity'] = "required";
$rules['conState'] = "required";
$rules['conZip'] = "required";
$rules['conEMail'] = "required";
$rules['conPhone'] = "required";
$rules['childFirstName'] = "required";
$rules['childLastName'] = "required";
$rules['childDOBDay'] = "required";
$rules['childDOBMonth'] = "required";
$rules['childDOBYear'] = "required";
$rules['childFavColor'] = "required";
$rules['partyDateDay'] = "required";
$rules['partyDateMonth'] = "required";
$rules['partyDateYear'] = "required";
$rules['partyTime'] = "required";
$rules['partySodaType'] = "required";
$rules['partyPizzaType'] = "required";
$rules['partyNbrKids'] = "required";
$rules['ccHolderName'] = "required";
$rules['ccType'] = "required";
$rules['ccNumber'] = "required";
$rules['ccExpDateMonth'] = "required";
$rules['ccExpDateYear'] = "required";
$this->validation->set_rules($rules);
$fields['conFirstName'] = "Contact First Name";
$fields['conLastName'] = "Contact Last Name";
$fields['conAddress'] = "Contact Address";
$fields['conCity'] = "Contact City";
$fields['conState'] = "Contact State";
$fields['conZip'] = "Contact Zip";
$fields['conEMail'] = "Contact E-Mail";
$fields['conPhone'] = "Contact Phone";
$fields['childFirstName'] = "Child's First Name";
$fields['childLastName'] = "Child's Last Name";
$fields['childDOBDay'] = "Child's Date of Birth: Day";
$fields['childDOBMonth'] = "Child's Date of Birth: Month";
$fields['childDOBYear'] = "Child's Date of Birth: Year";
$fields['childFavColor'] = "Child's Favorit Color";
$fields['partyDateDay'] = "Party Date: Day";
$fields['partyDateMonth'] = "Party Date: Month";
$fields['partyDateYear'] = "Party Date: Year";
$fields['partyTime'] = "Party Time";
$fields['partySodaType'] = "Party Soda Type";
$fields['partyPizzaType'] = "Party Pizza Type";
$fields['partyNbrKids'] = "Number of Kids";
$fields['ccHolderName'] = "Credit Card Holder Name";
$fields['ccType'] = "Credit Card Type";
$fields['ccNumber'] = "Credit Card Number";
$fields['ccExpDateMonth'] = "Credit Card Expiration: Month";
$fields['ccExpDateYear'] = "Credit Card Expiration: Year";
$this->validation->set_fields($fields);
if (!$this->validation->run()) {
//echo $this->validation->error_string;
$this->load->view('parties_birthday_reservation');
} else {
//$this->load->view('formsuccess');
echo "The form passed all test!";
}
}
(A part of the View 'parties_birthday_reservation')
Code:
<label id="conZip-label">Zip:
<input id="conZip-input" name="conZip" type="text" value="<?=$this->validation->conZip;?>">
</label>
<label id="conEMail-label">E-Mail Address:
<input id="conEMail-input" name="conEMail" type="text" value="<?=$this->validation->conEMail;?>">
</label>
<label id="conPhone-label">Phone Number:
<input id="conPhone-input" name="conPhone" type="text" value="<?=$this->validation->conPhone;?>">
</label>
(Another part of the View 'parties_birthday_reservation' that handles the error information)
Code:
<?php if ($this->validation->error_string <> ''): ?>
<div style="float:left; margin-left:10px; width: 310px; padding:10px; border: solid 1px #FF0000; margin-top:10px; color:#FF0000;">
Error(s): <br />
<?=$this->validation->error_string;?>
</div>
<?php endif; ?>
Any thoughts?