What is the best way to handle the placement and display of notification errors/messages for the demo site? It looks like the cms backend is placing them at the top of the demo site and i would like to place them within the the demo sites main div.
You will see those error messages at the very top of the page only if you are logged into FUEL because it has an area where it captures all error messages. The error messages should also be replicated in the main view of the page just above the form and should highlight the fields in red that have errors which is what a normal person not logged in will see. Try logging out of FUEL and testing the form and see if that was the issue.
Thanks, that did it and for all the hard work you put into fuel. If I want to replicate the notifications function in the demo, I would like to have a consistent messaging layout across site (forms, etc) what is the best way to implement that? I have copied the notifications block to the the demo block area, added the div to demo header and it looks like $vars[notifications] and $vars[errors] are being generated, but errorring out in the view, by the $notifications echo. Is this the best approach? Please advise.
What's the error you are seeing (when you say errorring out)?
Also, if you are using the Form_builder class, there is a display_errors property you can set to TRUE, which will display any validation errors generated by the Form_builders Validation object using the validate_helpers.php function display_errors() function.
I do not like the idea of having to force the flash data, $this->session->set_flashdata('success', 'message for view')), by using the a redirect(fuel_uri()), just to get the messages to populate the view. Is that standard practice for using flashdata in conjunction with messaging or am I missing something? Thanks
HI, I am also getting duplicate errors at the top and above the form. The user in this case will always be logged in, so I need the top screen errors to not show but i still need the errors above the form to show up. I am wondering what can be done? I am using similar code to the contact form and it is working bit I don't like the duplicate errors at the top like the other guy mentioned. Thanks. I decided not to start a new thread yet.
The errors shows at the very top of the page because a user is logged in and the validator object that the form_builder is using to validate has "register_to_global_errors" turned on. So try turning it off on the validator object that the form_builder object is using like so: $validator->register_to_global_errors = FALSE;
I am having the same problem, but your solution does not work.
First you wrote the same code for both: "If you are using just a straight up validator object you can do the following: $validator = register_to_global_errors = FALSE; If you are using a model's $validator = register_to_global_errors = FALSE;"
In my contact controller if I tried:
$this->validator = register_to_global_errors = FALSE;
$this->form_builder->set_validator($this->validator);
I get this error: Parse error: syntax error, unexpected '=' in C:\wamp\www\clarenssa\fuel\application\controllers\contact.php on line 34
If I changed it to:
$this->validator->register_to_global_errors = FALSE;
$this->form_builder->set_validator($this->validator);
I still see the error at the top.
I've corrected the typo above. With regards to your issue, is the validator object you are setting register_to_global_errors on the same one you are setting the rules up on and capturing the errors?
Comments
Also, if you are using the Form_builder class, there is a display_errors property you can set to TRUE, which will display any validation errors generated by the Form_builders Validation object using the validate_helpers.php function display_errors() function.
$notifications = $this->load->view('_blocks/notifications', $vars, TRUE);
$vars['notifications'] = $notifications;
I do not like the idea of having to force the flash data, $this->session->set_flashdata('success', 'message for view')),
by using the a redirect(fuel_uri()), just to get the messages to populate the view. Is that standard practice for using flashdata in conjunction with messaging or am I missing something? Thanks
$validator->register_to_global_errors = FALSE;
First you wrote the same code for both:
"If you are using just a straight up validator object you can do the following:
$validator = register_to_global_errors = FALSE;
If you are using a model's
$validator = register_to_global_errors = FALSE;"
In my contact controller if I tried:
$this->validator = register_to_global_errors = FALSE; $this->form_builder->set_validator($this->validator);
I get this error: Parse error: syntax error, unexpected '=' in C:\wamp\www\clarenssa\fuel\application\controllers\contact.php on line 34
If I changed it to:
$this->validator->register_to_global_errors = FALSE; $this->form_builder->set_validator($this->validator);
I still see the error at the top.
So how do I solve this problem please?