Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135

    Assegnare variabili ad immagini

    Ciao, ho questo form con il quale esporto in excel dei dati contenuti in una tbl access:
    codice:
    <form method="post" action="NuovaEsportazioneExcel.asp">   
        <input type="hidden" name="Id" value="<%=Id%>"> 
        
    <input type="image" img src="img/esporta_button.gif" border="0" hspace="1">
        <input type="image" img src="img/stam_mod.gif" border="0" hspace="1">
        </form>
    E' possibile assegnare all'img esporta_button.gif valore ID ed all'img stam_mod.gif valore 1 ?

    Grazie

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Potresti spiegarti meglio?

    Roby

  3. #3
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    Grazie Roby... il mio problema è che a secondo l'immagine sulla quale si clicca la pagina che processa i dati deve fare o meno un'operazione...

    -ad esempio clicco sull'img esporta_button.gif;
    -la pagina NuovaEsportazioneExcel.asp dovrà esportare solo una parte dei dati contenuti nella tabella asp (quelli della paginazione restituiti a video);

    -se invece clicco sull'img stam_mod.gif;
    -la pagina NuovaEsportazioneExcel.asp dovrà esportare tutti i dati contenuti nella tabella asp;

    mi spiego?

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Dai un value ai due input type image.

    Roby

  5. #5
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    Ho scritto così:
    codice:
    <form method="post" action="NuovaEsportazioneExcel.asp">   
        <input type="hidden" name="Id" value="<%=Id%>"> 
        
    <input type="image" name="stampa1" value="1" img src="img/esporta_button.gif" border="0" hspace="1">
        <input type="image" name="stampa0" value="0" img src="img/stam_mod.gif" border="0" hspace="1">
        </form>
    ma quando cerco di recuperare il valore in NuovaEsportazioneExcel.asp non si valorizzano:
    codice:
    stampa1 = request.form("stampa1")
    stampa0 = request.form("stampa0")
    response.write stampa1
    response.write stampa0

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    L'image corrisponde al submit e quindi devi metterne uno solo.
    Usa i button.

    Roby

  7. #7
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    Grazie Roby ho risolto, ma ho un altro problema:

    perchè tra queste condizioni la unica che funziona male (cioè invece di estrarre in excel tutti i record del db access ne estrae solo una parte...) è quella segnata in rossa???
    codice:
    if stampa1 = "Esporta in excel" then
    Set rs = DBconn.Execute("SELECT * FROM ListFiles where UploadID in ("&cod&") ORDER BY ID ASC") 
    
    elseif idcat <> "0" and iduoat <> "0" then
    Set rs = DBconn.Execute("SELECT * FROM ListFiles where ID_uoat in ("&iduoat&") ORDER BY ID ASC") 
    
    elseif idcat <> "0" then
    Set rs = DBconn.Execute("SELECT * FROM ListFiles where ID_cat in ("&idcat&") ORDER BY ID ASC") 
    
    elseif stampa0 = "Stampa in excel" then
    Set rs = DBconn.Execute("SELECT * FROM ListFiles ORDER BY ID ASC")  
    end if

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    L'ultima condizione deve essere un ELSE non un ELSEIF

    Roby

  9. #9
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    Originariamente inviato da Roby_72
    L'ultima condizione deve essere un ELSE non un ELSEIF

    Roby
    codice:
    if stampa1 = "Esporta in excel" then
    Set rs = DBconn.Execute("SELECT * FROM ListFiles where UploadID in ("&cod&") ORDER BY ID ASC") 
    
    elseif idcat <> "0" and iduoat <> "0" then
    Set rs = DBconn.Execute("SELECT * FROM ListFiles where ID_uoat in ("&iduoat&") ORDER BY ID ASC") 
    
    elseif idcat <> "0" then
    Set rs = DBconn.Execute("SELECT * FROM ListFiles where ID_cat in ("&idcat&") ORDER BY ID ASC") 
    
    else
    Set rs = DBconn.Execute("SELECT * FROM ListFiles ORDER BY ID ASC")  
    end if
    Stampa sempre e solo 450 records dei 3100 contenuti nel db...

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    E' ovvio che una delle condizioni che precedono l'ultima si verifica.
    Usa dei response.end dentro ad ognuna per verificare quale si verifica, no?

    Roby

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.