Seleção do popup

6 respostas
F

Alguém teria um exemplo, link de tutorial ou dica de componente que permita fazer seleções com popup? Tentei com o SelectOneMenu mas os itens são por demais extensos.
Abraço!
Fábio

6 Respostas

O

Se for jsf tenta usar o autocomplete :smiley:

F

além de haver muitas opções os textos são de 120 caracteres, entende? teria de ser com popup mesmo. Vi um tal de modalpanel do richfaces mas não tá funcionando.
Att.:
Fábio

O

fabiodamasceno4:
além de haver muitas opções os textos são de 120 caracteres, entende? teria de ser com popup mesmo. Vi um tal de modalpanel do richfaces mas não tá funcionando.
Att.:
Fábio

Cara, estou no celular, mas vamos lá…

Tente fazer um input com um botão ao lado e quando o usuário clicar no botão exiba uma dialog com uma tabela com checkbox…,com o valor selecionado altere o valor do input…

Não eh a melhor solução, mas acho que resolve…

F

eu fiz pra chamar um popup, mas não sei como seto a seleção no formulário de “baixo”. Esse dialog resolveria melhor o problema?
Att.:
Fábio

F

Esqueci de dizer que uso jsf com richfaces 3

F

Esse código funciona sem problemas:

<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>    
<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>    
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>    
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>    
     
<html>    
<head>    
<title></title>    
</head>  
<body>    
    <f:view>  
    <h:form>    
        <a4j:commandLink value="Open" onclick="javascript:Richfaces.showModalPanel('modalPanel');" />    
    </h:form>    
    
    <rich:modalPanel id="modalPanel">    
        <h:outputText value="TESTE TESTE TESTE!!!" />    
        <a4j:commandLink value="Close" onclick="javascript:Richfaces.hideModalPanel('modalPanel');" />    
    </rich:modalPanel>    
  </f:view>  
</body>    
</html>

e esse não, sendo que estão no mesmo projeto:

<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>    
<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>    
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>    
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view>
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            <title>PROCESSO ADMINISTRATIVO</title>
            <link rel="stylesheet" href="css/principal.css" type="text/css" />
            <link rel="stylesheet" href="css/formulario_sem_label.css" type="text/css" />
            <script type="text/javascript" src="js/tratamentoDeCampos.js"></script>
            <a4j:loadScript src="js/jquery.maskedinput-1.1.4.pack.js" />
        </head>
        <body>
            <table><tr><td align="left">
                        <h:form>
                            <div id="wrapper">
                                <div id="topo"><a href="index.jsp">Sair</a></div>
                                <div id="conteudo_principal">
                                    <h2>Cadastro de Processos Administrativos</h2>
                                    <br/>
                                    <rich:panel style="width:600px" >


                                        <h:inputHidden value="#{processoAdministrativoMB.pa.idProcessoAdministrativo}" id="id_processo_administrativo"/>
                                        <table cellspacing="5">
                                            <tr>
                                                <td>
                                                    <label for="matricula">Número processo:</label>

                                                </td>
                                                <td>
                                                    <h:inputText  value="#{processoAdministrativoMB.pa.codProcessoAdministrativo}"  style="width:150px;" id="cod_processo_administrativo" onkeypress="return SomenteNumero(event)" maxlength="30"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <label for="numeracao_antiga">Numeração antiga:</label>

                                                </td>
                                                <td>
                                                    <h:inputText  value="#{processoAdministrativoMB.pa.numeracaoAntiga}"  style="width:100px;" id="numeracao_antiga">
                                                        <rich:jQuery selector="#numeracao_antiga" query="mask('9999/9999')" timing="onload" />
                                                    </h:inputText>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <label for="objeto_assunto">Objeto/assunto:</label>

                                                </td>
                                                <td>



                                                    <h:inputHidden value="#{processoAdministrativoMB.pa.assuntoAdm.codAssunto}" id="cod_objeto_assunto"/>
                                                    <h:inputText readonly="true" value="#{processoAdministrativoMB.pa.assuntoAdm.descAssunto}"  style="background-color:#EEE9E9;width:400px;" id="objeto_assunto"/>
                                                    <h:commandLink onclick="javascript:window.open('busca_assunto_adm.jsp','busca','height=480,width=640,toolbar=no,scrollbars=no'); return false;">

                                                        <h:graphicImage style="vertical-align: middle" title="Objeto/Assunto" url="images/Search.gif" styleClass="borda_imagem"/>

                                                    </h:commandLink>
                                                    <a4j:commandLink value="Open" onclick="javascript:Richfaces.showModalPanel('modalPanel');" />


                                                </td>
                                            </tr>


                                        </table>






                                        <p><h:messages infoClass="statusOk" errorClass="statusErr" layout="table" showDetail="true" showSummary="false"/></p>

                                    </rich:panel>
                                    <p>

                                        <h:commandButton onclick="return validaForm()" styleClass="bt_normal" id="bt_cadastrar" action="#{funcionarioMB.cadastrar}" image="images/bt_salvar.png" />&nbsp;
                                        <h:commandButton styleClass="bt_normal" id="bt_listar" action="#{funcionarioMB.listar}" image="images/bt_listar1.png" />
                                    </p>
                                </div>
                                <div id="nav">
                                    <jsp:include page="menu.jsp"/>
                                </div>
                                <div id="rodape"><p class="copyright">Justiça Federal da Bahia, NUTEC</p></div>
                            </div>
                        </h:form>

                        <script type="text/javascript">
                            function validaForm(){

                                if (document.getElementById("formulario:matricula").value==''){
                                    alert('Preenchimento obrigatório da Matrícula');
                                    document.getElementById('formulario:matricula').focus();
                                    return false;
                                }
                                if (document.getElementById("formulario:nome").value==''){
                                    alert('Preenchimento obrigatório do Nome');
                                    document.getElementById('formulario:nome').focus();
                                    return false;
                                }
                    

                    

                                return true;
                            }
                            function verificaMatricula(){
                                if (document.getElementById("formulario:matricula").value==''){
                                    alert('É necessário preencher a matrícula para busca');
                                    document.getElementById('formulario:matricula').focus();
                                    return false;
                                }
                                return true;
                            }

                        </script>
                    </td> </tr></table>
        </body>
    </html>
    <rich:modalPanel id="modalPanel">    
        <h:outputText value="TESTE TESTE TESTE!!!" />    
        <a4j:commandLink value="Close" onclick="javascript:Richfaces.hideModalPanel('modalPanel');" />    
    </rich:modalPanel> 
</f:view>
Alguém teria uma luz?
Criado 13 de novembro de 2012
Ultima resposta 13 de nov. de 2012
Respostas 6
Participantes 2