04-28-2016 04:12 AM
Hello, I'm trying to make a validation of a custom document based on a cross validation (make a validation on a field based on what the user has filled on a second one). I made this technique based on a post here : http://www.nuxeo.com/blog/cross-validation-with-jsf/. -> An hidden field, that has two attributes that have the value of the fields I want to check.
This works fine in one case: two fields, a widget of type single vocabulary radio and the other of type single vocabulary But doesn't work with: two fields: a widget document suggestion (that has a "Document page provider name" that will query the database) and the other of type single vocabulary.
Here is the xhtml of template:
When I try the retrieve the value I have a null object on the fields that has the document suggestion: String inputId = (String) attributes.get(componentId); UIInput component = (UIInput) anchor.findComponent(inputId); if(component != null) { return component.getLocalValue(); }
Can somewone help me?
04-28-2016 04:14 AM
Here is the xhtml of template:
<div xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core">
<c:if test="#{widget.mode == 'edit'}">
<h:inputHidden value="needed" validator="#{nomenclature_liste_nomenclature.validaterListeEtNomenclatureLiee}"
id="#{widget.id}">
<f:attribute name="firstElt"
value="#{layout.widgetMap['nomenclature_liee'].id}" />
<f:attribute name="secondElt"
value="#{layout.widgetMap['type_de_metadonnees'].id}" />
</h:inputHidden>
<h:message for="#{widget.id}" styleClass="errorMessage" />
</c:if>
</div>
Java code:
public static Object retrieveInputComponentValue(UIComponent anchor, String componentId) {
Map<String,Object> attributes = anchor.getAttributes();
if(attributes != null)
{
String inputId = (String) attributes.get(componentId);
UIInput component = (UIInput) anchor.findComponent(inputId);
if(component != null)
{
return component.getLocalValue();
}
}
return null;
}
Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.