Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Il valore della select nella request

    Dunque, il mio problema è questo:

    Sto sviluppando una web application in java, jsp e javascript (utilizzando il framework struts).
    In una form devo inviare dei campi (ed uso il tag html di struts) ed in più il valore di una select che però viene caricata nella pagina attraverso un ajax.updater di prototype.

    Stampando lato server la request che arriva, mi sono accorto che il parametro codiceProfilo (che è il "name" della select, proprio non compare..a cosa può essere dovuto?

  2. #2
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998

    Re: Il valore della select nella request

    Originariamente inviato da dedal84
    ....a cosa può essere dovuto?
    A qualcosa presente nella pagina, che noi non vediamo

    ciao
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  3. #3
    Queste sono le due pagine, ho messo in grassetto la parte di cui parlo.


    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

    <html:html>
    <head>
    <link rel="stylesheet" type="text/css" href="CSS/general.css"/>
    <title>GESTIONE UTENTI</title>

    <script type='text/javascript' src='/ServerFarm/dwr/interface/dettagliutenti.js'></script>
    <script type='text/javascript' src='/ServerFarm/dwr/engine.js'></script>
    <script type='text/javascript' src='/ServerFarm/dwr/util.js'></script>
    <script src="/ServerFarm/javascript/prototype.js" type="text/javascript"></script>
    <script src="/ServerFarm/javascript/verifysession.js" type="text/javascript"></script>
    <script type="text/javascript">
    function makeEditable(){
    document.getElementById('nome').disabled=false;
    document.getElementById('cognome').disabled=false;
    document.getElementById('reparto').disabled=false;
    document.getElementById('nomeUtente').disabled=fal se;
    document.getElementById('password').disabled=false ;
    document.getElementById('profiliSelect').disabled= false;

    document.getElementById('insert').disabled = true;
    document.getElementById('modifica').disabled = true;
    document.getElementById('nuovo').disable = false;
    document.getElementById('update').disabled = false;
    }

    function editSelected(){
    oOpt = document.getElementById('utenti').options;
    for(i=0;i<oOpt.length;i++){
    if(oOpt[i].selected==true){
    var codice = oOpt[i].value;
    dettagliutenti.findUser(codice, visualizza);
    }
    }
    }

    function visualizza(utente){
    window.alert(utente['codiceProfilo']);
    document.getElementById('idUtente').value = utente['idUtente'];
    document.getElementById('nome').value = utente['nome'];
    document.getElementById('cognome').value = utente['cognome'];
    document.getElementById('reparto').value = utente['reparto'];
    document.getElementById('nomeUtente').value = utente['nomeUtente'];
    document.getElementById('password').value = utente['password'];
    oProfili = document.getElementById('profiliSelect').options;
    for(a=0;a<oProfili.length;a++){
    if(oProfili[a].value = utente['codiceProfilo']){
    oProfili[a].selected = true;
    window.alert(oProfili[a].value);
    }else{
    oProfili[a].selected = false;
    }
    }
    document.getElementById('nome').disabled = true;
    document.getElementById('cognome').disabled = true;
    document.getElementById('reparto').disabled = true;
    document.getElementById('nomeUtente').disabled = true;
    document.getElementById('password').disabled = true;
    document.getElementById('profiliSelect').disabled = true;
    document.getElementById('insert').disabled = true;
    document.getElementById('modifica').disabled = false;
    document.getElementById('nuovo').disable = false;
    document.getElementById('update').disabled = true;
    }

    function clearPage(){
    document.getElementById('nome').disabled = false;
    document.getElementById('cognome').disabled = false;
    document.getElementById('reparto').disabled = false;
    document.getElementById('nomeUtente').disabled = false;
    document.getElementById('password').disabled = false;
    if(document.getElementById('profiliSelect')!=null) {
    document.getElementById('profiliSelect').disabled = false;
    }

    document.getElementById('idUtente').value = "-1";
    document.getElementById('nome').value = "";
    document.getElementById('cognome').value = "";
    document.getElementById('reparto').value = "";
    document.getElementById('nomeUtente').value = "";
    document.getElementById('password').value = "";

    document.getElementById('insert').disabled = false;
    document.getElementById('modifica').disabled = true;
    document.getElementById('nuovo').disable = true;
    document.getElementById('update').disabled = true;


    }

    function eliminaSelezionato(){
    oOpt = document.getElementById('utenti').options;
    for(i=0;i<oOpt.length;i++){
    if(oOpt[i].selected==true){
    var codice = oOpt[i].value;
    dettagliutenti.deleteUser(codice, blank);
    clearPage();
    location.replace(location.href);
    }
    }
    }

    function blank(){}
    </script>
    </head>
    <body onload="clearPage()">
    <table>
    <html:form action="/utentigest.do?cmd=set">
    <tr>
    <td>
    <table>
    <tr>
    <td>
    Nome:
    </td>
    <td>
    <html:hidden styleId="idUtente" property="idUtente" value="-1"/><html:text styleId="nome" property="nome"/>
    </td>
    </tr>
    <tr>
    <td>
    Cognome:
    </td>
    <td>
    <html:text styleId="cognome" property="cognome"/>
    </td>
    </tr>
    <tr>
    <td>
    Reparto:
    </td>
    <td>
    <html:text styleId="reparto" property="reparto"/>
    </td>
    </tr>
    <tr>
    <td>
    UserName:
    </td>
    <td>
    <html:text styleId="nomeUtente" property="nomeUtente"/>
    </td>
    </tr>
    <tr>
    <td>
    Password:
    </td>
    <td>
    <html:text styleId="password" property="password"/>
    </td>
    </tr>
    <tr>
    <td nowrap="nowrap">
    Selezionare il profilo:
    </td>
    <td>

    <div id="codiceProfiloDiv">
    </div>
    <script type="text/javascript">
    var url = '/ServerFarm/pages/gestioni/utenti/updateProfili.jsp';
    var profiliListUpdater = new Ajax.Updater( 'codiceProfiloDiv', url,
    {
    method: 'post',
    evalScripts: true
    }
    );
    </script>

    </td>
    </tr>
    <tr>
    <td>campo prova</td>
    <td><input type="text" id="prova" name="campoprova"></td>
    </tr>
    <tr>
    <td>
    <html:submit styleId="insert" value="Inserisci utente" style="width:146"/>
    </td>
    <td>
    <input type="button" id="modifica" onclick="makeEditable()" value="Modifica" disabled="true" style="width:146"/>
    </td>
    </tr>
    <tr>
    <td>
    <input type="button" id="nuovo" value="Clear" onclick="clearPage()" style="width:146"/>
    </td>
    <td>
    <html:submit styleId="update" value="Aggiorna" disabled="true" style="width:146"/>
    </td>
    </tr>
    <tr>
    <td>
    <input type="button" title="Elimina l'utente selezionato nella lista" id="elimina" value="Elimina" onclick="eliminaSelezionato()" style="width:146"/>
    </td>
    </tr>
    </table>
    </td>
    <td valign="top">
    <table>
    <tr>
    <td colspan="2">
    <div id="utentiDiv">
    </div>
    <script type="text/javascript">
    var url = '/ServerFarm/pages/gestioni/utenti/updateUtenti.jsp';
    var userListUpdater = new Ajax.Updater( 'utentiDiv', url,
    {
    method: 'post',
    evalScripts: true
    }
    );
    </script>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </html:form>
    </table>
    </body>
    </html:html>


    E questa è la pagina che viene caricata dall'ajax updater:

    <%@ page import="kelyanlab.srvrfarm.dao.profili.*,java.util .*;"%>
    <select id="profiliSelect" name="codiceProfilo" style="width:146">

    <%
    List<ProfiliDTO> profili = ProfiliDAO.findAll(null);
    for(ProfiliDTO profilorofili){%>
    <option value='<%=profilo.getIdProfilo()%>'><%=profilo.get Descrizione()%></option>
    <%}%>

    </select>

  4. #4
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    c'e' un errore che si ripresenta ciclicamente su questo forum:
    <form> non puo' stare dentro <table>
    o si apre prima e si chiude dopo la tabella
    oppure dev' essere tutto contenuto in una cella

    sistema e riprova

  5. #5
    E' vero..era dovuto a quello..ora tutto funziona a dovere.

    Grazie mille!! ^_*

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.