Setting Validation Error Messages |
[eluser]mradlmaier[/eluser]
Hi, The User Guide states: Quote: Either I am missing something in the User Guide, but what is the name of a rule? The Guide also states: Quote: So, where is the name of this rule? I need to know this to set error messages for a each form field, like "The email is required." Thanks, Michael
[eluser]khuram[/eluser]
Hi Mike I am a total nobody on CI. Can you please tell me something about my questions. Its here http://ellislab.com/forums/viewthread/96974/. I'll check the user guide for your problem in the meanwhile. Much thanks. I know its kind of queer but what the hell. i aint getting no where with ppl not replying me.
[eluser]eger[/eluser]
The rule in the example is "required". So you would set Code: $this->form_validation->set_message('required', 'Umm... %s is required buddy.');
[eluser]khuram[/eluser]
Hey what about my problem please I know it sounds offensive but so does coming first time to a forum and not getting a reply for argument's sake, I have tried to search the topic before posting. once again, [a]http://ellislab.com/forums/viewthread/96974/[/a]
[eluser]mradlmaier[/eluser]
Eger, So, that way I specify one error message for ALL 'required' rules, with substitued human field names, right? But I cannot specify an error message per rule AND per field, right? Michael
[eluser]eger[/eluser]
[quote author="mradlmaier" date="1226712976"]Eger, So, that way I specify one error message for ALL 'required' rules, with substitued human field names, right? But I cannot specify an error message per rule AND per field, right? Michael[/quote] I don't see a way to do that according to the docs. Maybe someone else might have a clever way to do this...
[eluser]moodh[/eluser]
form_error('fieldname'); also returns true or false, so a simple if works if you want to write your own messages per field instead of per rule: Code: if(form_error('fieldname')) { edit, sorry for the old topic bump, but he asked for more ways =) |
Welcome Guest, Not a member yet? Register Sign In |