Multiselect Dropdown validation [Solved- Me Stupid :) ] |
[eluser]tkyy[/eluser]
use this to build your dropdown list, instead of the ci validation (replace your variables) Code: <?php
[eluser]TheFuzzy0ne[/eluser]
Not any more. I tried printing a coffee and the liquid blew my printer up.
[eluser]tkyy[/eluser]
[quote author="TheFuzzy0ne" date="1243276283"]Not any more. I tried printing a coffee and the liquid blew my printer up.[/quote] i could really use some java atm, been coding for 15 hrs
[eluser]TheFuzzy0ne[/eluser]
It's at times like that we need a caffeine drip. Although you're welcome to make yourself a coffee - http://ellislab.com/forums/viewthread/11...15/#584104
[eluser]xpix[/eluser]
@tkyy The output should be the same. here is the html <select size="5" name="programs[]"> <option value="109">xxxx</option> <option value="106">cccc</option> <option value="110">vvvvvvv</option> <option value="102">aaaaa</option> <option value="108">wwwww</option> <option value="111">yyyyy</option> <option value="103">bbbb</option> </select>
[eluser]tkyy[/eluser]
[quote author="xpix" date="1243276573"]@tkyy The output should be the same. here is the html <select size="5" name="programs[]"> <option value="109">xxxx</option> <option value="106">cccc</option> <option value="110">vvvvvvv</option> <option value="102">aaaaa</option> <option value="108">wwwww</option> <option value="111">yyyyy</option> <option value="103">bbbb</option> </select>[/quote] yewza diz Code: <?php
[eluser]xpix[/eluser]
So you say I should do a custom validation function. The problem is: is this a bug in CI? Am I the only one with this problem? This is taken from the Form_validation.php Code: // Cycle through the rules for each field, match the Not an expert but it seems that the rules are applied on the POST fields. If a post does not exist but a rule exists the rule has no meaning. The only solution I see here is to check for the POST value and throw a custom error.
[eluser]TheFuzzy0ne[/eluser]
The _field_data variable is set when you set a rule using $this->form_validation->set_rules(). Please see the source code for the set_rules() method to see what information it holds. I'm quite sure the rule will be executed so long as no other rules appear before it. Things like trim() and checking it's actually been set should be possible from within your custom method. I'm starting to have second thoughts however, so I'm going to try it out shortly, and then get back to you.
[eluser]TheFuzzy0ne[/eluser]
I'm starting to wonder if it's an error in your code that's not allowing the validation to run. I ran this test: Code: <?php When I submitted the form without any items selected, the form validation library told me that it was a required field, which it should. This confirms that the validation library performs the test even if it doesn't exist in the post array. |
Welcome Guest, Not a member yet? Register Sign In |