Alimentation automatique d'un textBox
hajoura89
Messages postés
2
Date d'inscription
Statut
Membre
Dernière intervention
-
hajoura89 Messages postés 2 Date d'inscription Statut Membre Dernière intervention -
hajoura89 Messages postés 2 Date d'inscription Statut Membre Dernière intervention -
Bonjour, SVP je voudrais savoir comment je peux alimenter un textBox suite à une selection à partir d'un combobox: voici le code que j'ai fait mais c'est erroné
et Merci d'avance
--La fonction javascript:
<SCRIPT LANGUAGE="javascript">
function test(maForm) {
var idF=document.maForm.idFormation.value;
var idP="select idPlan from Formation where idFormation='"+valeur+"'";
if(valeur != 'Selectionner Votre Choix')
{
document.maForm.idPlan.text=idP;
document.maForm.Submit();
}
else document.maForm.idPlan.value=" ";
</SCRIPT>
-----le combobox:
<select name="idFormation" onclick="test(maForm);">
<option value="Selectionner Votre Choix">Selectionner Votre Choix</option>
<%
try{
cnx=DriverManager.getConnection(url);
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("connection etablie");
stmt=cnx.createStatement();
String requete="select theme,idFormation from Formation ";
rs=stmt.executeQuery(requete);
%>
<%
while(rs.next()){%>
<option value="<%=rs.getString(2)%>"><%=rs.getString(1) %></option>
<%}%>
<%
}catch(Exception e){
System.out.println("connection non etablie");
System.out.println(e);
}
%>
</select>
et Merci d'avance
--La fonction javascript:
<SCRIPT LANGUAGE="javascript">
function test(maForm) {
var idF=document.maForm.idFormation.value;
var idP="select idPlan from Formation where idFormation='"+valeur+"'";
if(valeur != 'Selectionner Votre Choix')
{
document.maForm.idPlan.text=idP;
document.maForm.Submit();
}
else document.maForm.idPlan.value=" ";
</SCRIPT>
-----le combobox:
<select name="idFormation" onclick="test(maForm);">
<option value="Selectionner Votre Choix">Selectionner Votre Choix</option>
<%
try{
cnx=DriverManager.getConnection(url);
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("connection etablie");
stmt=cnx.createStatement();
String requete="select theme,idFormation from Formation ";
rs=stmt.executeQuery(requete);
%>
<%
while(rs.next()){%>
<option value="<%=rs.getString(2)%>"><%=rs.getString(1) %></option>
<%}%>
<%
}catch(Exception e){
System.out.println("connection non etablie");
System.out.println(e);
}
%>
</select>
A voir également:
- Alimentation automatique d'un textBox
- Réponse automatique thunderbird - Guide
- Logiciel de sauvegarde automatique gratuit - Guide
- Recherche automatique des chaînes ne fonctionne pas - Guide
- Réponse automatique gmail - Guide
- Sommaire automatique word - Guide