![]() |
Datamapper: Problem validation - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Datamapper: Problem validation (/showthread.php?tid=47827) |
Datamapper: Problem validation - El Forum - 12-23-2011 [eluser]scherman[/eluser] Hi, i have a problem with the datamapper, and i new on that. i hope you can help me. I have a controller's method called "create" which add an "article" object to the Database. Each article has one "Author". The form is composed by: - Title (input text) - Author (dropdown: default-index = 0) -> I load the authors objects at this dropdown, so the user can chose one. The "create" method at the controller have this: Code: $article = new Article(); Article's model (only the validation's part) Code: var $validation = array( The problem is, if i let the text field empty and chose none authors, the error is only about the title field, but it says nothing about the author field (and i have no authors with id=0) I want that, if the user let the form empty (text's field empty, and the dropdown's index = 0), shows an error which include "complete the title" but "select an author" too. How can i do that? I listen any others ways to do it too. Thank you so much and sorry for my english. |