01-15-2016 09:56 AM
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 06: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-18-2016 03:28 AM
[Greg Drayon](https
01-18-2016 03:33 AM
OK, I clearly missed the hint. So you want the 2nd dropdown list to change when you change the value of the 1st one, without reloading the page nor saving the document? Like with some Ajax process?
01-18-2016 03:37 AM
[Greg Drayon](https
01-18-2016 03:39 AM
Got it. Yes, it won't do. When you create the document, the "field_1" has no value. Whe you save, the value is registered and you can see the second drop down list in the edition form because it is calculated to be displayed server side. I guess if you set a news value in the first drop down list, then save, then try to edit again, the second drop down list if correctly updated? If so, it's because the new value is not sent to the server before your sabing, and the page is not recalculated. You should check [this page](https
01-18-2016 03:48 AM
[Greg Drayon](https
01-18-2016 04:34 AM
It can. But there is no Ajax in your given code.
01-18-2016 04:38 AM
Can you try getting rid of the h
01-18-2016 04:43 AM
My bad, I hadn't seen the "f
01-18-2016 04:49 AM
Thank you [Greg Drayon](https
01-18-2016 05:05 AM
Can you please share what you had to change to make it working?
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.