# \<b:selectOneMenu relacionados

![](https://2578941663-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6ze2c8GK7mFBZX%2F-Lc1WjGeqF4Ig-44ZLgX%2F-Lc1X6GY8HbI3u9w_NKc%2Frrrr.png?generation=1554820659052911\&alt=media)

SelectOnmenu con eventos ajax y update

```
 <b:selectOneMenu class="fullWidth required required ui-selectonemenu-label ui-inputfield ui-corner-all"
                                                     rendered="#{ordenController.writable}"
                                                     process="tipoorden"
                                                     id="tipoorden" value="#{ordenController.orden.tipoorden}"  
                                                     required="true" requiredMessage="#{msg['field.tipoorden']} #{msg['info.required']}"
                                                     update=":form:msgs, :form:grupo, :form:proveedor, :form:bodega, :form:tienda "
                                                     onchange="ajax:ordenController.changeTipoorden()"
                                                     >
                                        <!-- TODO: update below reference to list of available items-->
                                        <f:selectItem itemLabel="#{app['selectonemenu.select']}" itemValue="#{null}"
                                       />
                                        <f:selectItems value="#{ordenController.tipoordenServices.tipoordenList}"
                                                       var="item"
                                                       rendered="#{ordenController.writable}"
                                                       itemValue="#{item}"
                                                       itemLabel="#{item.descripcion}"

                                                       />
                                        <f:converter binding="#{tipoordenConverter}" />

                                        <p:ajax event="change" listener="#{ordenController.handleSelect}"
                                                process="tipoorden"  update=" :form:msgs,:form:subtipoorden" /> 
                                    </b:selectOneMenu>
```

Otro selectOneMenu

```
 <b:selectOneMenu class="fullWidth required required ui-selectonemenu-label ui-inputfield ui-corner-all"
                                                     rendered="#{ordenController.writable}"
                                                     id="subtipoorden" value="#{ordenController.orden.subtipoorden}"  
                                                     update=":form:msgs, :form:grupo, :form:proveedor, :form:bodega, :form:tienda "
                                                     required="true" requiredMessage="#{msg['field.tipoorden']} #{msg['info.required']}"
                                                     process="subtipoorden"

                                                     onchange="ajax:ordenController.changeSubtipoorden()"
                                                     >
                                        <!-- TODO: update below reference to list of available items-->
                                        <f:selectItem itemLabel="#{app['selectonemenu.select']}" itemValue="#{null}"/>
                                        <f:selectItems value="#{ordenController.subtipoordenList}"
                                                       var="item"

                                                       rendered="#{ordenController.writable}"
                                                       itemValue="#{item}"
                                                       itemLabel="#{item.descripcion}"

                                                       />
                                        <f:converter binding="#{subtipoordenConverter}" />


                                    </b:selectOneMenu>
```

Colocar un \<h:groupPanel > para lo update

```
  <h:panelGroup id="grupo">
                                <div class="form-group row" >
                                    <p:outputLabel class="col-xs-2 col-form-label"   rendered="#{ordenController.writable and ordenController.proveedorShow  }" value="#{msg['field.proveedor']}"/>
                                    <div class="col-xs-8">

                                        <p:autoComplete scrollHeight="250" dropdown="false" size="80"
                                                        id="proveedor"
                                                        emptyMessage="#{app['info.nohayregistros']}"
                                                        title="#{app['info.by']} #{msg['field.idproveedor']}"
                                                        label="#{app['info.by']} #{msg['field.idproveedor']}"
                                                        rendered="#{ordenController.writable and ordenController.proveedorShow  }"
                                                        alt="#{msg['info.searchby']} #{msg['field.idproveedor']}"
                                                        value="#{ordenController.proveedorSelected}"
                                                        completeMethod="#{ordenController.proveedorServices.completeRazonsocial}"
                                                        var="p" itemLabel="#{p.razonsocial}" itemValue="#{p}" forceSelection="true"> 
                                            <f:converter binding="#{proveedorConverter}"/>
                                            <p:column>
                                                <h:outputText value="#{p.razonsocial}" />
                                            </p:column>
                                            <p:column>
                                                <h:outputText value="#{p.idproveedor}" />
                                            </p:column>


                                        </p:autoComplete>
                                    </div>

                                </div>

                                <div class="form-group row" >
                                    <p:outputLabel class="col-xs-2 col-form-label" rendered="#{ordenController.writable and ordenController.bodegaShow}" value="#{msg['field.bodega']}"/>
                                    <div class="col-xs-8">
                                        <p:autoComplete  scrollHeight="250"   dropdown="false"  size="45"  
                                                         emptyMessage="#{app['info.nohayregistros']}" 
                                                         title="#{app['info.by']} #{msg['field.idbodega']}"
                                                         label="#{app['info.by']} #{msg['field.idbodega']}"
                                                         id="bodega"
                                                         rendered="#{ordenController.writable and ordenController.bodegaShow}"
                                                         alt="#{app['info.searchby']} #{msg['field.idbodega']}"
                                                         value="#{ordenController.bodegaSelected}"  
                                                         completeMethod="#{ordenController.bodegaServices.completeIdbodega}"  
                                                         var="p"
                                                         itemLabel="#{p.idbodega}  #{p.direccion} "
                                                         itemValue="#{p}" forceSelection="true"> 
                                            <f:converter binding="#{bodegaConverter}"/>

                                            <p:column>
                                                <h:outputText value="#{p.idbodega}" />
                                            </p:column>
                                            <p:column>
                                                <h:outputText value="#{msg['field.telefono']} #{p.telefono}" />
                                            </p:column>
                                            <p:column>
                                                <h:outputText value="#{msg['field.direccion']} #{p.direccion}" />
                                            </p:column>


                                        </p:autoComplete>  
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <p:outputLabel class="col-xs-2 col-form-label"    rendered="#{ordenController.writable and ordenController.tiendaShow}" value="#{app['info.by']} #{msg['field.tienda']}"/>
                                    <div class="col-xs-4">
                                        <p:autoComplete  scrollHeight="250"   dropdown="false"  size="45"  
                                                         emptyMessage="#{app['info.nohayregistros']}" 
                                                         title="#{app['info.by']} #{msg['field.tienda']}"
                                                         id="tienda"
                                                         label="#{app['info.by']} #{msg['field.tienda']}"
                                                         rendered="#{ordenController.writable and ordenController.tiendaShow}"
                                                         alt="#{app['info.searchby']} #{msg['field.tienda']}"
                                                         value="#{ordenController.tiendaSelected}"  
                                                         completeMethod="#{ordenController.tiendaServices.completeTienda}"  
                                                         var="p"
                                                         itemLabel="#{p.tienda} "
                                                         itemValue="#{p}" forceSelection="true"> 
                                            <f:converter binding="#{tiendaConverter}"/>

                                            <p:column>
                                                <h:outputText value="#{msg['field.tienda']} #{p.tienda}" />
                                            </p:column>
                                            <p:column>
                                                <h:outputText value="#{msg['field.idtienda']} #{p.idtienda}" />
                                            </p:column>


                                        </p:autoComplete>   
                                    </div>

                                </div>
                                <div class="form-group row" >
                                    <p:outputLabel class="col-xs-2 col-form-label" value="#{msg['field.activo']}"/>
                                    <div class="col-xs-4">
                                        <avbravo:activo beanValue="#{ordenController.orden.activo}" rendered="#{ordenController.writable}"/>

                                    </div>
                                </div>
                            </h:panelGroup>
```

## Codigo de los Controller

```
public String changeSubtipoorden(){
        try {
            bodegaShow=false;
            tiendaShow =false;
            proveedorShow =false;
            if(orden.getSubtipoorden().getDescripcion().indexOf("Bodega")!=-1){
                bodegaShow=true;
                }
            if(orden.getSubtipoorden().getDescripcion().indexOf("Tienda")!=-1){
                tiendaShow=true;
            }

            if(orden.getSubtipoorden().getDescripcion().indexOf("Proveedor")!=-1){
                proveedorShow=true;
            }


        } catch (Exception e) {
             JsfUtil.errorMessage("changeSubtipoorden( )" + e.getLocalizedMessage());
        }
        return "";
    }// </editor-fold>
    public String changeTipoorden(){
        try {
            bodegaShow=false;
            tiendaShow =false;
            proveedorShow =false;

        } catch (Exception e) {
             JsfUtil.errorMessage("changeTipoorden() " + e.getLocalizedMessage());
        }
        return "";
    }
```
