Validate multiple fields inside p:dataList in JSF - validation

I have to validate a name and group field for uniquness for an item. The user can create several items. When the users clicks on a save button I want to check the name and group for all items. In the backing beans the values of the last item are always not set in the validate method. For the last item the values are not set because I am inside the validation at this time. But I do not know how to get the inputtexts name and group for the last item and call getSubmittedValue() because all is inside a dataList and the ids are generated. Any idea?
Cheers
Oliver

Related

powerautomate - check empty field condition

I am doing approval flow with powerautomate.
some of my approval processes don't need 1st level (manager) approval.
so I want to do it by not filling in the manager name when I add new item.
-if the manager name is empty field found in Sharepoint list, > update the item with "manager null" in approval history column.
the following screenshot is my flow. but it didn't not update the item if the manager column is empty.
only working if the manager file has value, and it update the item.
how can I achieve the empty field check.?
I assume your Manager field allows multiple values and is of type person or group. This is because I see you have an apply to each loop.
I would remove the apply to each and simply check the length of the Manager field itself, not one of its properties like displayName,etc (that will add the loop).
Below is an example.
In the condition I used this expression. Add that via the expression editor:
length(triggerOutputs()?['body/Manager'])

save a different value in the redux store than what is displayed on the frontend

I'm wondering if I can store a different value in the redux form FieldArray than what's displayed on the frontend.
Using the example from the docs: Each club has a club name and consists out of various members. I want to introduce another model called group which also consists out of at least one member.
I combine the firstName and lastName field to one field and let the user type in either the members individually OR the user can type in a group name which then fills in all members of that group but on the frontend, only the group name shows up, instead of each member name individually.
Currently, I allow this and then before I post the values to the server, I fetch the members of that group via a get request and then switch the group name for the member names.
I'm wondering if there is a more elegant (and faster) way to do this? I was looking at the parse method but it changes the value right away and doesn't let me display it how the user typed it in.

Can I use a JSF validator both ways?

I have an application where you can create Items. Those items are saved in a database with the primary key beeing its itemnumber. In the facelet where you create the Item I have a h:inputText with a validator which checks if the item is already in the database or not. If it is I give out an error message. I now have a second facelet where you can order Items by placing its number into an inputText field. Now I want the Validator to react in the opposite way as before.
So is there any way I can define the expected outcome of a validator? Or do I have to make a second validator?

How can i do a dynamic SelectOneRadio in ADF with CollectionModel binding?

im trying to do a SelectOneRadio that was linked with a binding in ADF.
Mi binding have this structure:
Parent named "Group" (ID, Group, Orden).
Child named "Action" (ID, Action, Desc).
I want one radio group for each "Group" with each "Action".
The web don't have error or i cant see it.
And if i can do this, can i get the value of each radio group?
Thanks for all.
I will first check if the value set on af:iterator is returning expected number of values/rows/items. Then I will check if each of those row item has children property, and see if that too is type of List (or related types). If you follow these two instructions, you will know why this isn't working.

How to get object instead of string from dropdown list in Spring MVC

On my JSP page i have following dropdown list:
<form:select path="companies" name="company">
<form:options items="${companies}" itemValue="name" itemLabel="name"/>
</form:select>
This list displays name attribute of Company object. when I choose value and submit form, my controller receive this attribute.
I looking for way to how to receive this object in controller instead of single attribute.
So, first of all I recommend having the company id, if there is one, instead of company name as the value that will we submitted from the drop down. You can still display the name as the description but send the id as the value. An id would usually be the primary key in your company table, if you have one. Names are not very unique.
Then when you receive this id as a parameter in your spring controller method you will get a handle to the same list that was used to render the drop down and get the object. The thing about spring is that object models only persist as long as the request by default, so the list you used to render the drop down would have disappeared by the time the user sends the id back. The first request was used to render the page, and the second request is the sending of the parameter. So, you will want to persist this list in memory longer than the request. You can make that list persist longer by keeping it in the session. Spring has an annotation for making model attributes persist at session level. Just keep in mind that the object will then live in the session as long as the user is logged in unless you remove it.
I kind of wonder why you want the object. Often times the id is all you need because you set that in the db as the users company of choice and you are all set. However, I can't tell what you are trying to do.

Resources