Re: Dans un champ Activex Internet Explorer, comment cocher un bouton radio

Posté par Anonyme le 19/4/2006 16:08:24
Bonjour et merci pour ton aide

J'ai bien trouvé ce code javascript mais je n'arrive pas à l'adapter à windev.


J'ai essayé ceci ...

mhtmDoc3 est un objet OLE dynamique // IHTMLDocument3
mdocDocument est un objet OLE dynamique // HTMLDocument
mhtmInputBox est un objet OLE dynamique // HTMLImhtmDoc3

mhtmDoc3 = activex1>>Document
mdocDocument = mhtmDoc3
mhtmInputBox = mdocDocument>>forms("Data")>>elements>>"genre"

setCheckedValue(mhtmInputBox,"M")

FONCTION setCheckedValue(radioObj, newValue)
radioLength est un entier = radioObj>>length
i est un entier
POUR i = 0 A radioLength-1
radioObj(i)>>checked = Faux
SI radioObj(i)>>value = newValue ALORS
radioObj(i)>>checked = Vrai
FIN
FIN

Mais je n'arrive pas à indicer par i le paramètre radioObj qui est mis en erreur à la compilation




--------- code java script a transposer ---------------------

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
if(!radioObj)
return;
var radioLength = radioObj.length;
if(radioLength == undefined) {
radioObj.checked = (radioObj.value == newValue.toString());
return;
}
for(var i = 0; i < radioLength; i++) {
radioObj[i].checked = false;
if(radioObj[i].value == newValue.toString()) {
radioObj[i].checked = true;
}
}
}

Cette contribution était de : http://old.wdforge.org/newbb/viewtopic.php?forum=17&topic_id=3867&post_id=16277