Validation Thread |
[eluser]cinewbie81[/eluser]
Hi all, Can i have something like this for my validation: Code: If Dropdown menu select item == '0' then Anyone ?
[eluser]Nick Husher[/eluser]
The answer is yes; at least I'm 99% sure it is.
[eluser]Developer13[/eluser]
I think the question would be better answered if the author posted some specific code along with the specific problems they have with that code.
[eluser]cinewbie81[/eluser]
Ignored my post above, and look at the following code: I have a select box with following value: Code: <select name="gender" id="gender"> In my controller i want something like this: Code: function validation() what validation rules should i put for gender select box ?? I dont think rules['gender'] = 'required' is the correct one .. anyone ?
[eluser]Nick Husher[/eluser]
The way I'd do it (and there might be a better way) is to create a simple callback that checks that: Code: ...
[eluser]cinewbie81[/eluser]
Hi Nick Husher, That's works .. But do u have any idea how to re-populate the gender value when there's a error in validation ?? When i choose the gender = male, but for other field i type in invalid format data. After the validation error message display, gender will reset back to 'Please select a gender type' instead of 'Male'. I know how to do it for input type, but for select box i have no idea
[eluser]Nick Husher[/eluser]
In your view, set up the following code: Code: <?php To do this you need to include the form helper and set your validation library up for field repopulation. Form Helper - scroll to the 'form_dropdown' section Validation - scroll to the 'repopulating the form' section.
[eluser]cinewbie81[/eluser]
Validation question again: What's the validation rules for decimal points in CI?? |
Welcome Guest, Not a member yet? Register Sign In |