Visualizzazione dei risultati da 1 a 8 su 8

Discussione: Help!!! button

  1. #1

    Help!!! button

    Ciao a tutti.
    Sono un nuovo utente e da qualche settimana ho iniziato a programmare in asp.
    Da ieri sono bloccato e anche se ho reperito da internet vari esempi non riesco a venirne fuori.
    Vi espongo il mio problema sperando in un Vostro aiuto...
    In un file htm ho inserito il codice che visualizza due pulsanti chiamati subprev e subnext.
    Nel file asp invece vorrei che ogni volta che viene premuto un pulsante mi eseguisse un codice diverso, del tipo:
    if request.form "subprev" <> 0 then........
    Else
    if request.form "subnext" <> 0 then .....
    Il mio problema e' che non e' mai verificato la condizione degli if.
    Vi ringrazio in anticipo,
    Ciao.

  2. #2
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    44
    Posta il codice così qualcuno ti può aiutare... sola la parte che interessa ovviamente.
    Non sei veramente finito fino a quando hai una buona storia da parte e qualcuno a cui raccontarla!

  3. #3
    Questo e' il codice del file visualizza.htm

    <html>
    <head>
    <meta http-equiv="Content-Language" content="it">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Segnalazioni</title>
    </head>
    <body>
    <FORM ACTION="Mostra_Segn.asp METHOD="post" enctype="multipart/form-data">
    <table border="1" width="100%" id="table1" height="115">
    <tr>
    <td colspan="8" height="46">
    <p align="center"><font size="6">Segnalazioni</font></td>
    </tr>
    <tr>
    <td width="12%"></td>
    <td style="word-spacing: 0; position: relative; margin-top: 0; margin-bottom: 0" width="16%">
    <p align="center">
    <button name="subPrev" type="submit" width="1100" height="500" value="Indietro "></button>
    </form>
    </p>
    </td>
    <td width="8%">
    <p align="center"><font size="4">Turno</font></td>
    <td width="15%"><font size="4"><% =DatiTurno(0) %></font></td>
    <td width="8%">
    <p align="center"><font size="4">Data</font></td>
    <td width="15%"><font size="4"><% =DatiTurno(2) %></font></td>
    <td width="15%">
    <p align="center">
    <button name="subNext" type="submit" width="1100" height="500" Value="Avanti "></button>
    </form>
    </td>
    <td width="12%"></td>
    </tr>
    </table>
    </body>
    </html>

    Mentre questo e' il file Mostra_Segn.asp

    <%
    Option Explicit
    '--------------------------------------------------------
    'Purpose: mostra le news per cambiarele
    'Date: 24 Aprile 2007
    'Commenti:
    '--------------------------------------------------------
    %>

    <%
    Dim objConn, strConn, objRs, strsql, macchina, message, DatiTurno
    Dim id, nome, turnoCor, dataCor
    call Main()
    Sub Main()
    'If Session("login") then
    macchina = "star"
    DatiTurno = Prendi_DatiTurno() 'array con il turno, descrizione, capoturno e data turno corrente
    strsql = costruisci_query(DatiTurno,macchina)

    ' if prev button was hit on the form
    If Request.Form("subPrev")<> "" then
    'dtCurViewMonth = DateAdd("m", -1, frmDate)
    response.Write " hai premuto il pulsante di sinistra"
    'DatiTurno(0)=DatiTurno(0)-1
    ' if DatiTurno(0) = 0 then
    ' DatiTurno(0) = 3
    ' DatiTurno(2) = DateAdd("g", -1, DatiTurno(2))
    ' strsql = costruisci_query(DatiTurno,macchina)
    ' End If
    ' if next button was hit on the form
    Else
    If Request.Form("subNext")<> "" Then
    response.Write " hai premuto il pulsante di destra"
    'dtCurViewMonth = DateAdd("m", 1, frmDate)
    Else
    'response.Write " non hai premuto nulla"

    End If
    End If

    %>


    <%
    ' Visualizza_dati(strsql)
    End Sub
    .
    .
    .
    .

  4. #4
    Il file visualizza.htm l'ho un po aggiustato.
    Cosi va un po meglio ma non riesco a entrare nell'If del file asp.
    <body>
    <FORM ACTION="Mostra_Segn.asp" METHOD="post" enctype="multipart/form-data">
    <table border="1" width="100%" id="table1" height="115">
    <tr>
    <td colspan="8" height="46">
    <p align="center"><font size="6">Segnalazioni</font></td>
    </tr>
    <tr>
    <td width="12%"></td>
    <td style="word-spacing: 0; position: relative; margin-top: 0; margin-bottom: 0" width="16%">
    <p align="center">
    <button name="subPrev" type="submit" style="width: 100; height: 26">
    Indietro</button>
    </p>
    </td>
    <td width="8%">
    <p align="center"><font size="4">Turno</font></td>
    <td width="15%"><font size="4"><% =DatiTurno(0) %></font></td>
    <td width="8%">
    <p align="center"><font size="4">Data</font></td>
    <td width="15%"><font size="4"><% =DatiTurno(2) %></font></td>
    <td width="15%">
    <p align="center">
    <button name="subNext" type="submit" style="width: 100; height: 26">
    Avanti</button>

    </td>
    <td width="12%"></td>
    </tr>
    </table>
    </form>

  5. #5
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    44
    Nel file .htm non ci posso essere chiamate ad asp:

    <% =DatiTurno(0) %>
    <% =DatiTurno(2) %>
    Per la trasmissione dati togli l'enctype nel tag form.
    Non sei veramente finito fino a quando hai una buona storia da parte e qualcuno a cui raccontarla!

  6. #6
    Ho tolto quello suggeritomi ma il problema persiste.
    Qualsiasi sia il pulsante che premo entra sempre nel primo if e mi scrive che ho premuto il pulsante di sinistra. Inoltre lo fa solo una volta

  7. #7
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    44
    Modifica i due bottoni così:

    Codice PHP:
    <input name="subNext" type="submit" style="width: 100; height: 26" /> 
    Per l'if nella pagina asp la struttura corretta sarebbe questa, anche se funzionerebbe anche come è adesso.

    Codice PHP:
     If Request.Form("subPrev")<> "" then
       response
    .Write " hai premuto il pulsante di sinistra"
    Elseif Request.Form("subNext")<> "" Then
      response
    .Write " hai premuto il pulsante di destra"
    Else
    'response.Write " non hai premuto nulla"
    End If 
    Non sei veramente finito fino a quando hai una buona storia da parte e qualcuno a cui raccontarla!

  8. #8
    I button gli ho modificati come mi hai detto ma le modifiche apportate non
    hanno risolto il problema.
    Sempre da internet ho trovato che inserendo un input di tipo hidden in fondo al file htm e
    un request del valore dell'input sul file asp si risolve il problema.
    Ho verificato ed infatti il problema e' sparito
    L'unica cosa e' che non so a cosa serve. :master:
    Mi sapete dare una delucidazione in merito?
    Grazie di nuovo

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 © 2026 vBulletin Solutions, Inc. All rights reserved.