Welcome Guest, Not a member yet? Register   Sign In
form validation fails but only 1 rule set
#1

[eluser]JanDoToDo[/eluser]
hey guys

Im having a problem with form validation. The validation is failing even thooough the only condition set is true.
Code:
$this -> form_validation -> set_rules('gender', 'Gender', 'required');
is the only rule that im setting however it always fails the validation, regardless of the gender i specifiy. its almost as if the validation is validating all elements even thgouh i dont want it to.

here is my form. Interestingly if i deselect the display photo checkbox (it is checked by default) the form always returns false even thgouh there are no validation errors as no validation is set on it.

Code:
<td>I'm</td>
                    <td>Male&lt;?php echo form_radio($male); ?&gt; Female &lt;?php echo form_radio($female); ?&gt; <td>
                </tr>
                <tr>
                    <td>...who is</td>
                    <td>&lt;?php echo form_dropdown('age_range', $age_range); ?&gt;</td>
                </tr>
                <tr>
                    <td>..and if is from</td>
                    <td>&lt;?php echo form_dropdown('location', $loc); ?&gt; (or near to)</td>
                </tr>
                <tr>
                    <td>Only display if they </td>
                    <td>have a photo &lt;?php echo form_checkbox($photo); ?&gt;</td>
                </tr>
                <tr>
                    <td colspan="2">&lt;?php echo form_submit('submit', 'Search'); ?&gt;</td>
                </tr>

could someone help me out?
its very urgent!
#2

[eluser]xeroblast[/eluser]
i dunno exactly what you mean but there is an error in one of your closing tags..

<td>Male&lt;?php echo form_radio($male); ?&gt; Female &lt;?php echo form_radio($female); ?&gt; <td>

there is no closing tag... </td>
#3

[eluser]JanDoToDo[/eluser]
Thankyou for spotting that. I fixed it now. Thanks!
#4

[eluser]xeroblast[/eluser]
glad to help... Wink




Theme © iAndrew 2016 - Forum software by © MyBB