Visualizzazione dei risultati da 1 a 6 su 6

Discussione: non funziona selected

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    312

    non funziona selected

    ciao,

    ho una variabile di nome "casa_costruttice" con valore "Mercedes".

    devo all'interno del mio tag select confrontare il valore della variabile con i valori della tabella.
    Visto che nella tabella esiste il record Mercedes, come mai me lo seleziona????

    <%
    do while not rs.eof
    %>
    <option value="<%=rs("casa_costruttrice")%>" <%if rs("casa_costruttrice") = casa_costruttrice then response.write "selected" end if%>>
    <%=rs("casa_costruttrice")%>
    </option>
    <%
    rs.movenext
    Loop


    c'è forse un errore nell' IF??

    %>

  2. #2

    Re: non funziona selected

    Originariamente inviato da carmi
    ciao,

    ho una variabile di nome "casa_costruttice" con valore "Mercedes".

    devo all'interno del mio tag select confrontare il valore della variabile con i valori della tabella.
    Visto che nella tabella esiste il record Mercedes, come mai me lo seleziona????

    <%
    do while not rs.eof
    %>
    <option value="<%=rs("casa_costruttrice")%>" <%if rs("casa_costruttrice") = casa_costruttrice then response.write "selected" end if%>>
    <%=rs("casa_costruttrice")%>
    </option>
    <%
    rs.movenext
    Loop


    c'è forse un errore nell' IF??

    %>
    prova così


    <option value="<%=rs("casa_costruttrice")%>" <%if CStr(rs("casa_costruttrice")) = CStr(casa_costruttrice) then response.write "selected" end if%>>

  3. #3
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    casa_costruttrice

    Se anche nello script hai scritto così ecco svelato l'arcano..
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  4. #4
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    312
    Originariamente inviato da Corwin
    casa_costruttrice

    Se anche nello script hai scritto così ecco svelato l'arcano..
    scusa Corwin ma non ho capito cosa intendi!!!!

  5. #5
    Utente di HTML.it
    Registrato dal
    Oct 2001
    Messaggi
    312

    Re: Re: non funziona selected

    Originariamente inviato da fcrisafi
    prova così


    <option value="<%=rs("casa_costruttrice")%>" <%if CStr(rs("casa_costruttrice")) = CStr(casa_costruttrice) then response.write "selected" end if%>>
    non funziona nemmeno cosi'!!!!!

  6. #6
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584

    Re: non funziona selected

    Originariamente inviato da carmi
    ho una variabile di nome "casa_costruttice" con valore "Mercedes".
    Ti sei dimenticato una R. Se hai fatto lo stesso errore nello script

    casa_costruttice = "Mercedes"

    e poi

    <option value="<%=rs("casa_costruttrice")%>" <%if rs("casa_costruttrice") = casa_costruttrice then response.write "selected" end if%>>

    non funziona perchè per il programma casa_costruttrice è vuoto. In alternativa potrebbe essere che nel database Mercedes è scritto tutto maiuscolo...
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

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.