Omnifaces validateMultiple component only takes UIInput values, any workaround for considering UIOutput too?

StackOverflow https://stackoverflow.com/questions/21741805

Question

So, I have an Address to validate and it has 4 input fields and 4 output fields, basically the 4 output fields are city,state,county and municipality. There are not editable, so they will be populated by zipCode lookup only. But when I validate , I need to pass in all the values, the lookup values too. <o:validateMultiple> only takes in Input Component values, so I tried to make them h:inputText too and then disabled=true since they aren't editable, but looks like <o:validateMultiple> ignores values of disabled input components as well. So, any alternatives?

Initially I did it bu embedding all the ids with respective bindings using f:attributes on the first inputText component and used JSF validator to grab getAttributes and validated that way, which worked OK, but since validateMultiple reduces lot of that, I wanted to use this , but looks like it is not straight forward.

Something like this could have helped :

<o:validateMultiple id="myId" components="foo bar baz" validator="#{bean.validateValues}" />
    <h:message for="myId" />
    <h:inputText id="foo" />
    <h:inputText id="bar" />
    <h:inputText id="baz" />

public boolean validateValues(FacesContext context, List<UIComponent> components, List<Object> values) {
    // ...
}

Any help is appreciated! Thanks!

Was it helpful?

Solution

Use <h:inputHidden> if you need hidden inputs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top