How to add multiple message validation in only one growl message - jsf-2

I have a p:growl for show message validation, but it shows a growl for each message validation, is there any way to show multiples messages validation in only one message p:growl?

It's just how the growl works. Each message will appear in its own panel. I don't think you can change it unless you develop a custom growl component on your own and put <p:messages> in it :)

As Mr.J4mes has mentioned, it's not a 'add on' function of Growl, you could however get PrimeFaces source and recompile it with your changes/requirements.
GrowlRenderer, puts all of the messages into a JSON object e.g..
{summary:"Successful",detail:"Hello ss",severity:'info'},{summary:"Second Message",detail:"Additional Info Here...",severity:'info'}]});});
Then the grow.js line 32 does a for each loop of 'each mesage', and does a render... using renderMessage on line 50. (may may not change depends fversion you're using)...
basically, you could do several things to fix it, (ie pass in all objects not for each and do it in the renderMessage, or keep as is but just don't end the tags until all messages are finished)..
This is less work than creating your own widget etc, adding a var to the primefaces widget, and conditionally doing this is probably a better option - otherwise you're totlally overwriting the functionality.

Related

Umbraco7 - ContentService.SaveAndPublishWithStatus VS ContentService.SendToPublication

I have an application that uses a combination of ContentService.Saved & ContentService.Saving to extend Umbraco to manage content.
I have two websites in one Umbraco installation I am using those methods to keep content up to date in different parts of the tree.
So far I have got everything working the way I wanted to.
Now I want to add a feature that: depending on which Umbraco User is logged in, will either publish the content or simply send it for approval.
So I have changed some lines of code from:
cs.SaveAndPublishWithStatus(savedNode, 0, false)
To this:
cs.SendToPublication(savedNode);
Now the problem that I am finding is that unlike the SaveAndPublishWithStatus() method, the cs.SendToPublication(); doesn't have the option of passing false so that a save event is not raised. So I get into an infinite loop.
When I attach the debugger and manually stop the infinite loop the first time it calls cs.SendToPublication(savedNode); I get exactly the behavior I want.
Any ideas about how I can get round this problem? Is there a different method that I should be using?
You are correct in saying that it currently isn't possible to set raiseEvents to false when sending an item to publication - that's a problem.
I've added that overload in v. 7.6 (http://issues.umbraco.org/issue/U4-9490).
However considering that you need this now, an interim solution could be that you make sure your code is only run once when triggered by the .Saved / .Saving events.
One way to do this would be to check the last saved date (UpdateDate) in your code. If the content was saved within the last second of the current save operation, you know that this is a save event triggered by the save happening in SendToPublication action. Then you also know that the item has already been sent to publication and that this doesn't need to be done again - thereby preventing the endless loop from happening.

Formatting Error Message in rails

I have a stock validation error message that displays on the top of the screen when a field isn't met. I would like to format the message so that they display next to the field, instead of on the top of the screen. Does anyone know how I could do that?
There is a gem out there called client_side_validation which does exactly what you are looking to do. Also check out the RailsCast for an example on how to get set up with the validation library.

Adding one error message to two checkboxes in Rails

I have two checkboxes that I'm adding a simple custom validator on. I want to check that either one or the other (or both) are checked, but that they aren't both empty.
To do this, I've written put a simple unless checkbox1 || checkbox2 line in my custom validator method. However, when outputting the error message, I realized that the error.add takes the form field as first parameter. I don't want the error message to be specifically for one of the other checkbox; I just want it to say, one or both need to be selected.
How can I do this?
Just found the answer:
errors.add(:base, 'Generic error message')

List all the invalid controls in Orbeon forms

I have 30 fields in my form. At the bottom of the form I have a button where if I click on it, it should display all the fields which are invalid. Invalid includes not filling the mandatory fields also.
Using xforms:trigger I can create a button and using DOMActivate even I can write xforms:action. But what should I write inside the xforms:action to list all invalid fields.
You can implement your own error summary by listening to events like xforms-valid and xforms-invalid, keeping track of which controls are valid and invalid. But this is not a trivial task, especially if you want to handle repeats, and even nested repeats. Fortunately, this work has been done already for you, and the code has been put in a reusable component: <fr:error-summary>.
If you are using Form Runner, the error summary is setup for you by default. Otherwise, see this documentation on how to use the error summary component.

Oracle Forms - Display message blocks rest of the code execution or message doesn't show

I'm trying to show a message on a form without success.
What I'm doing is: When a new line is clicked, I use the WHEN-NEW-RECORD-INSTANCE to do some verifications and some enabling/disabling on the form and showing up the message. The problem is sometimes it does the enabling/disabling but not the message, then I click another line and it shows the previous message but doesn't do the enabling/disabling...
I've already tried some stuff like:
message('message');
n := Show_alert('message');
with and without SYNCHRONIZE;
I don't think it's the code itself blocking the messages... or I'm missing something...
Does anyone ever had this problem?
Can someone tell me the various options to display messages and their differences?
Thanks.
I managed to fix this using the WHEN-MOUSE-CLICK trigger instead.
I didn't want to use this at first because when I clicked the already selected line it would show the message again but I made some code verification and fixed it.
Someone can close this.
thanks.

Resources