Dropdown not getting validated |
[eluser]xtremer360[/eluser]
I'm trying to figure out what I'm doing wrong here. For some reason the dropdown isn't getting validated correctly because it should be coming up with an error message saying this field is required but its not. It should be just like this page for the dropdown. I'm also trying to get it to display the Select an Option default option when the form opens and have that be the option that if its still selected when the form submits then it throws the error saying the field is required. Also not sure about why there's an inner border around the form. http://www.kansasoutlawwrestling.com/peach/forms.html Code: <?php echo form_label('Recipient', 'recipient'); ?> This is what the rendered page looks like http://jsfiddle.net/tNFNY/
[eluser]InsiteFX[/eluser]
Code: <?php
[eluser]CroNiX[/eluser]
Try set_value('recipient', 0); instead of -1 for the selected value to set the select value to what the last form submission was or 0 (your default value) if no form was submitted.
[eluser]xtremer360[/eluser]
So I ended up changing it to a muliple select with the following and trying having it validate and nothing I'm still not getting a validation error. Code: <?php echo form_label('Recipient', 'recipient'); ?>
[eluser]CroNiX[/eluser]
Well, now you removed the default option with the 0 index. Show where you set the validation rules for recipient and where you execute them.
[eluser]xtremer360[/eluser]
Here's the controller code for when the user submits the form: Code: // Function used for login form validation
[eluser]xtremer360[/eluser]
Keep in mind that this multiple select can have one selection or more.
[eluser]CroNiX[/eluser]
In your code you have pmmmodel and also pmmodel. Which is it or do you actually have 2 models named like that?
[eluser]xtremer360[/eluser]
oops but by that time the field should have already been validated
[eluser]CroNiX[/eluser]
All of your options have integers as values, so it will always pass your rule because it has a value which will make it pass the Required rule and it is an integer. |
Welcome Guest, Not a member yet? Register Sign In |