01-15-2016 12:56 PM
I'm using the following code to display some drop down lists based on condition , it's working fine when creating a document but when trying to modify the documents , the select doesn't change i keep getting the first value . I'm using Nuxeo 7.10 Here is the code i'm using :
<div xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:nxu="http://nuxeo.org/nxweb/util"
xmlns:nxd="http://nuxeo.org/nxweb/document"
xmlns:nxh="http://nuxeo.org/nxweb/html"
xmlns:nxdir="http://nuxeo.org/nxdirectory"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
<h:head>
</h:head>
<h:form >
<h:selectOneMenu id="thekeywords" value="#{field}">
<f:selectItem itemLabel="Sélectionner une valeur" />
<f:selectItem itemValue="Techniques de l’entreprise" itemLabel="Techniques de l’entreprise" />
<f:selectItem itemValue="Développement du dirigeant" itemLabel="Développement du dirigeant" />
<f:selectItem itemValue="Environnement de l’entreprise" itemLabel="Environnement de l’entreprise" />
<f:selectItem itemValue="Management" itemLabel="Management" />
<f:ajax render="tables" />
</h:selectOneMenu>
<h:panelGroup id="tables">
<h:outputLabel for="#{widget.id}_tech" rendered="#{field == 'Techniques de l’entreprise'}" >Nature </h:outputLabel>
<h:selectOneMenu id="#{widget.id}_tech" value="#{field_1}" rendered="#{field == 'Techniques de l’entreprise'}">
<f:selectItem itemLabel="Sélectionner une valeur" />
<f:selectItem itemValue="Stratégie" itemLabel="Stratégie" />
<f:selectItem itemValue="Ressources Humaines" itemLabel="Ressources Humaines" />
<f:selectItem itemValue="Marketing" itemLabel="Marketing" />
<f:selectItem itemValue="Commercial" itemLabel="Commercial" />
<f:selectItem itemValue="Nouvelles Technologies" itemLabel="Nouvelles Technologies" />
<f:selectItem itemValue="Finance et Fiscalité" itemLabel="Finance et Fiscalité" />
<f:selectItem itemValue="Gouvernance" itemLabel="Gouvernance" />
<f:ajax render="tables" />
</h:selectOneMenu>
<h:outputLabel for="#{widget.id}_dev" rendered="#{field == 'Développement du dirigeant'}">Nature </h:outputLabel>
<h:selectOneMenu id="#{widget.id}_dev" value="#{field_1}" rendered="#{field == 'Développement du dirigeant'}">
<f:selectItem itemLabel="Sélectionner une valeur" />
<f:selectItem itemValue="Connaissance de soi" itemLabel="Connaissance de soi" />
<f:selectItem itemValue="Développer ses savoirs faire" itemLabel="Développer ses savoirs faire" />
<f:selectItem itemValue="Développer son Équilibre personnel" itemLabel="Développer son Équilibre personnel" />
<f:ajax render="tables" />
</h:selectOneMenu>
<h:outputLabel for="#{widget.id}_env" rendered="#{field == 'Environnement de l’entreprise'}">Nature </h:outputLabel>
<h:selectOneMenu id="#{widget.id}_env" value="#{field_1}" rendered="#{field == 'Environnement de l’entreprise'}">
<f:selectItem itemLabel="Sélectionner une valeur" />
<f:selectItem itemValue="Changement et Transformation" itemLabel="Changement et Transformation" />
<f:selectItem itemValue="Géopolitique" itemLabel="Géopolitique" />
<f:selectItem itemValue="Prospective" itemLabel="Prospective" />
<f:selectItem itemValue="Culture Générale" itemLabel="Culture Générale" />
<f:selectItem itemValue="Créativité" itemLabel="Créativité" />
<f:selectItem itemValue="Innovation" itemLabel="Innovation" />
<f:ajax render="tables" />
</h:selectOneMenu>
<h:outputLabel for="#{widget.id}_mng" rendered="#{field == 'Management'}">Nature </h:outputLabel>
<h:selectOneMenu id="#{widget.id}_mng" value="#{field_1}" rendered="#{field == 'Management'}">
<f:selectItem itemLabel="Sélectionner une valeur" />
<f:selectItem itemValue="Comportement" itemLabel="Comportement" />
<f:selectItem itemValue="Leadership" itemLabel="Leadership" />
<f:selectItem itemValue="Organisation" itemLabel="Organisation" />
<f:selectItem itemValue="Négociation" itemLabel="Négociation" />
<f:selectItem itemValue="Changement" itemLabel="Changement" />
<f:ajax render="tables" />
</h:selectOneMenu>
</h:panelGroup>
</h:form>
</div>
In the console i'm getting those errors :
Failed to load resource: the server responded with a status of 404 (Introuvable)
'webkitMovementX' is deprecated. Please use 'movementX' instead. :8080/ged/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.5.0.Alpha3/PackedCompressed/org.richfaces/jquery.js:78
'webkitMovementY' is deprecated. Please use 'movementY' instead. :8080/ged/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.5.0.Alpha3/PackedCompressed/org.richfaces/jquery.js:78
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/. :8080/ged/javax.faces.resource/jsf.js.faces?ln=javax.faces:1
default.js:6043 Uncaught TypeError: jQuery(...).initTipsy is not a function
(program):3 Uncaught TypeError: jQuery(...).focusFirst is not a function
Update
Here is the code i'm using to display the select widget :
<widget name="rubrique" type="template">
<labels>
<label mode="any">
Rubrique
</label>
</labels>
<translated>true</translated>
<fields >
<field>rens:rubrique</field>
<field>rens:nature</field>
</fields>
<properties mode="any">
<property name="template">
/widgets/select_flavor_widget_temp.xhtml
</property>
</properties>
</widget>
01-18-2016 09:13 AM
You should get rid of the h:form tag: it seems that you have two nested forms, since the edit layout is already surrounded by a h:form tag, and this could produce strange behaviors. The h:head tag should be removed too.
01-17-2016 08:53 AM
Have you tried to display the values of field and field_1? Maybe their value or their type isn't right.
01-18-2016 03:53 AM
Hi [Greg Drayon](https
01-18-2016 04:40 AM
Yes. But have you tried to display #{field_1}" and #{field}" in your page in creation AND in edition?
01-18-2016 04:53 AM
[Greg Drayon](https
01-18-2016 05:07 AM
You should try to display them directly, without an h
01-18-2016 05:28 AM
Thank you [Greg Drayon](https
01-18-2016 05:54 AM
I would first check the class of the field value (#{field.class} and #{field_1.class}). Then, as it should be a String, according to your example, and if it has one of the values you want it to have (either "Techniques de l’entreprise", "Développement du dirigeant", "Environnement de l’entreprise" or "Management"), I would then try the "eq" operator in my EL instead of "==". No sure it would solve your problem, but maybe worth it.
01-18-2016 06:11 AM
[Greg Drayon](https
01-18-2016 06:20 AM
If it is, then if you don't see you dropdown list in your page, you should check the page code source (CRTL + U, if you use Firefox). As the rendition of the page code source is calculated server side, you should appear inside, even if the displayed page itself doesn't show the drop down list. If it doesn't appear in the page code source, then JS is not involved. One again, I would check in the page itself the values and class of field and field_1. Not through a summary layout or any other page, but from the edition form itself. But that's just me.
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.