Welcome Guest, Not a member yet? Register   Sign In
Global / Generic Validation Error?
#1

[eluser]K-Fella[/eluser]
Hi,

Is there an easy way to set a global validation error - an error you can display at the top of your form if any other validation errors exist?

I ask because I have a rather long member signup form and instead of displaying all errors in one list at the top, I've set it to display seperate errors under the form elements.

But if the error message is below the page fold, people won't see it unless they scroll. I'd like to display a global error at the top of the form informing them of errors somewhere on the page.
#2

[eluser]alpar[/eluser]
you can overwrite the error_string like so

Code:
....

   if ($this->validation->run()){
      ...
   }else{
     $this->validation->error_string = 'Your global error';
     //do the other stuff    
   }

in the view files you will show the error_string as usual.

I know it's not the most elegant solution but it works. You could also extend the Validation class, add a flag to it rather to use global error or not, make it pull global error from language files, and show it if the flag is set. Post questions if you like the solution better, but you don't know how to implement it.




Theme © iAndrew 2016 - Forum software by © MyBB