[eluser]datdesignguy[/eluser]
Hi All,
I ended up cutting out hmvc for this app, as I realized the code wasn't going to need to be portable. So I'm using a straight CI 1.7.1 install.
I have an account creation page with the following fields: firstName,lastName,email,password,password_conf, and timezone.
The rules I have set for validation are as follows:
Code:
$this->load->library('form_validation','','validation');
$this->validation->set_error_delimiters('<div class="error">','</div>');
$this->validation->set_rules('firstName','First Name','trim|required');
$this->validation->set_rules('lastName','Last Name','trim|required');
$this->validation->set_rules('email','E-Mail Adress','strtolower|trim|required|valid_email|callback_checkexists');
$this->validation->set_rules('password','trim|required|min_length[6]|max_length[32]');
$this->validation->set_rules('password_conf','trim|required|matches[password]');
$this->validation->set_rules('timezone','required');
This is what my view file looks like:
Code:
<%= form_open('account/create'); %>
<fieldset>
<legend>Create Your Account: </legend>
<%= form_error('firstName'); %>
<div class="form_row">
<label for="firstName">First Name: </label>
<input type="text" id="firstName" name="firstName" value="<%= set_value('firstName'); %>" />
</div>
<%= form_error('lastName'); %>
<div class="form_row">
<label for="lastName">Last Name: </label>
<input type="text" id="lastName" name="lastName" value="<%= set_value('lastName'); %>" />
</div>
<%= form_error('email'); %>
<div class="form_row">
<label for="email">E-mail Address: </label>
<input type="text" id="email" name="email" value="<%= set_value('email'); %>" />
</div>
<%= form_error('password'); %>
<div class="form_row">
<label for="password">Password: </label>
<input type="password" id="password" name="password" value="" />
</div>
<%= form_error('password_conf'); %>
<div class="form_row">
<label for="password_conf">Confirm Password: </label>
<input type="password" id="password_conf" name="password_conf" value="" />
</div>
<%= form_error('timezone'); %>
<div class="form_row">
<strong>Please select Your Time Zone:</strong><br/>
<select name="timezone">
<% $tzs = timezones(); %>
<% foreach($tzs as $k => $v):%>
<option <%= set_select('timezone',$k);%> value="<%=$k%>"><%=$this->lang->line($k);%></option>
<% endforeach; %>
<option value='' <%=set_select('',TRUE);%>>Please Set Your Time Zone</option>
</select>
</div>
<div class="form_row">
<input type="submit" id="doCreate" name="doCreate" value="Create My Account!" />
</div>
</fieldset>
</form>
I cannot for the life of me figure out why, when I test the form, it thinks there is nothing wrong even though I am leaving: password, password_conf, and timezone unset. Even if I leave the whole form blank, it only shows errors for the first 3 fields (firstName,lastName, and email) any idea what I'm doing wrong?
Thanks!
- Greg J