...

View Full Version : i desperately need some javascript expert help



LondonBoy
11-09-2006, 05:58 PM
Hello all,

I'm working on the same problem for about 5 days now and my boss is looking at me oddly, so if someone could help me out I would very much apreciate it.

I have 3 groups of option boxes, depending on which one you choose the subsequent group of option boxes will appear, so it's a relational group of option boxes. Now with the second group, with the last choice when i click on that, it's only with that option wherein the last group of option boxes appear and whatever i choose doesn't get registered.

So I keep getting an alert saying plz make a choice even though I select a choice. I would very apreciate if someone can help me out on this because I am extremely lost for a few days now.

here is the view source code, i thought this would be good since it's a client side problem

LondonBoy
11-09-2006, 05:58 PM
script>
history.forward();
</script>
<link rel="stylesheet" type="text/css" media="all" href="jsc/calendar-win2k-cold-1.css" title="win2k-cold-1" />
<!-- main calendar program -->
<script type="text/javascript" src="jsc/calendar.js"></script>

<!-- language for the calendar -->
<script type="text/javascript" src="jsc/lang/calendar-en.js"></script>

<!-- the following script defines the Calendar.setup helper function, which makes
adding a calendar a matter of 1 or 2 lines of code. -->
<script type="text/javascript" src="jsc/calendar-setup.js"></script>


<script language="JavaScript" src="js/masks.js"></script>
<script language="JavaScript" src="js/functions.js"></script>
<script language="JavaScript">
function action_commande(q){
if (q== 0){
alert('One peux pas commander! Pas de quantit&#233; disponible en stock.');
}
else{
alert('Vous pouvez commander &#224; hauteur de :' + q) ;
}
}
//function attacheMask(txtbox){
//oNumberMask = new Mask("###", "number");
//}


</script>


<html>
<head>
<link rel="STYLESHEET" type="text/css" href="css/cm/style.css">
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</head>
<body>
<div class="center">
<table class="tbl">
<tr>
<td colspan="3">
<table cellpadding="0" cellspacing="1" border="0" width="100%" class="header2">
<tr>
<td width="100" rowspan="3"><img src="css/cm/i/logo.jpg" border="0"> </td>

<table cellpadding="0" cellspacing="1" style="display:none;">

</table>
</td>
</tr>
<!--- <tr><td align="right" colspan="2"><a href="changeLang.asp">English</a></td></tr> --->
<tr><td colspan="2">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<td align="right" background="i/back_ligne.gif" class="whiteH"><strong>Date :</strong>
07 Novembre 2006
</td>
</tr>
</table>
</td></tr>
</table>
</td>
</tr>

</table>

<table class="tbl">
<tr>
<td colspan="2" class="center">
<h3>Choisir un mod&#232;le </h3>
</td>
</tr>
<tr><td colspan="2" class="header2"> <a href='showOrds.asp'>Soumission en cours</a>&nbsp;|&nbsp;<a href='ShowCat.asp'>Nouvelle soumission</a>&nbsp;|&nbsp;<a href='asp/sForm/UserCloseOrder.asp'>Quitter</a></td></tr>
</table>
<table class="tbl">
<tr>
<td class="menuG" valign="top">
<table width="100%" border="1" cellpadding="2" cellspacing="2" bordercolor="#FFFFFF" bgcolor="#9F9860">
<tr>

<td><a href="showCat.asp">Mod&#232;le </a></td>
</tr>
<tr>

<td><a href="showDim.asp">Dimension</a></td>
</tr>

<tr>

<td><a href="showFen.asp">Fen&#234;tres</a></td>
</tr>
<tr>

<td class='selMenu'><a href="showKit.asp">Kit D&#233;cors</a> </td>
</tr>
<tr>

<td><a href="showAcc.asp">Acc&#233;ssoires</a></td>
</tr>
<tr>

<td><a href="showConf.asp">Confirmation</a></td>
</tr>
<tr>

<td><a href="showFin.asp">Fin</a></td>
</tr>
</table>
<br>
<br>
<br>

<table class="log">
<tr><th colspan="2">Session</th></tr>
<tr><td><strong>Model</strong></td><td>1-Mod&#232;le 1</td></tr>
<tr><td><strong>Dim</strong></td><td>12x8(6)</td></tr>
<tr><td><strong>NFen</strong></td><td>&nbsp;-&nbsp;()</td></tr>
<tr><td valign="top"><strong>Kits</strong></td><td>

None

</td></tr>
<tr><td valign="top"><strong>Accs</strong></td><td>

None

</td></tr>
</table>
</td>
<td valign="top">
<script language="JavaScript">

var kit_porte=0;
function disp(v){
if (v) {
document.getElementById('ac01').style.display='inline';
document.getElementById(kit_porte).style.display='inline';
}
else {
document.getElementById('ac01').style.display='none';
document.getElementById('633').style.display='none';
document.getElementById('635').style.display='none';
document.getElementById('636').style.display='none';
document.getElementById('637').style.display='none';
}
}
function getRdoBtn(btn, n){
for(i=0; i<n;i++){
if (btn[i].checked) return btn[i].value;
}
return 0;
}
function setValue(i){
//alert("Set value for id="+i);
for (j=1; j<9;j++) {
eval('document.frmKit.qty'+j+'.selectedIndex=0;');
eval('document.frmKit.qty'+j+'.disabled=1;');
}
eval('document.frmKit.qty'+i+'.disabled=0;');
eval('document.frmKit.qty'+i+'.selectedIndex=1;');
}
function setValue2(i,q){
//alert("Set value for id="+i);
for (j=1; j<9;j++) {
eval('document.frmKit.qty'+j+'.selectedIndex=0;');
eval('document.frmKit.qty'+j+'.disabled=1;');
}
eval('document.frmKit.qty'+i+'.disabled=0;');
eval('document.frmKit.qty'+i+'.selectedIndex='+q+';');
}

function getValue(i){
return eval('document.frmKit.qty'+i+'.value;');
}
function validateBloc1(frm){
if (getRdoBtn(frm.rdoModel,7))return true;
return false;
}
function getBloc1Value(frm){
return getRdoBtn(frm.rdoModel,7);
}
function validateBloc2(frm){
if (getRdoBtn(frm.rdoKit3,6))return true;
return false;
}
function getBloc2Value(frm){
i=getRdoBtn(frm.rdoKit3,6);
//v=getValue(i);
return i;
}
function validateBloc3(frm){
if (getRdoBtn(frm.rdoKit2,16))return true;
return false;
}
function getBloc3Value(frm){
return getRdoBtn(frm.rdoKit2,16);
}
function validateNext(frm){
if(!frm.chkKit.checked) {
document.frmK.kits_c.value="empty";
document.frmK.submit();
}
else{
if (validateBloc1(frm)&& validateBloc2(frm) && validateBloc3(frm)){
document.frmK.bloc1.value=getBloc1Value(frm);
document.frmK.bloc2.value=getBloc2Value(frm);
document.frmK.bloc3.value=getBloc3Value(frm);
document.frmK.submit();
}
else{
if (!validateBloc1(frm)) alert("Veuillez choisir un model kit d&#233;cor");
if (!validateBloc3(frm)) alert("Veuillez choisir une porte");
if (!validateBloc2(frm)) alert("Veuillez choisir un kit de fen&#234;tre.");
}
}
}

function showPorte(v){
if (v) document.getElementById('porte').style.display='inline';
}
function showKit(v,p){
kit_porte=p;
if (p!=633) document.getElementById(633).style.display='none';
if (p!=635) document.getElementById(635).style.display='none';
if (p!=636) document.getElementById(636).style.display='none';
if (p!=637) document.getElementById(637).style.display='none';
n=6;
for(i=0; i<n;i++){
document.frmKit.rdoKit3[i].checked=false;
}
if (v) document.getElementById(p).style.display='inline';
}
</script>


<table width="100%" border="0" align="center">
<tr>
<td width="385" align="right" valign="top" bgcolor="#D9D9D8"><strong>Mod&egrave;le:</strong></td>
<td colspan="" align="left" bgcolor="#D9D9D8">Mod&#232;le 1</td>
</tr>
<tr>
<td width="385" align="right" valign="top" bgcolor="#D9D9D8"><strong>Dimensions:</strong> </td>
<td colspan="" align="left" bgcolor="#D9D9D8">
<table width="200" border="1" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="center">Fa&#231;ade</td>
<td align="center">Cot&#233;</td>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center" bgcolor="#EEE05B">12</td>
<td align="center" bgcolor="#EEE05B">8</td>
<td align="center" bgcolor="#EEE05B"><input name="radiobutton" type="radio" value="radiobutton" checked="checked" disabled="disabled" /></td>
</tr>
</table>
</td>
</tr>
<form name="frmKit">

<tr>
<td width="385" align="right" valign="top" bgcolor="#D9D9D8"><strong>Kit D&#233;cor:</strong></td>
<td colspan="-2" align="left" bgcolor="#D9D9D8"><input type="checkbox" name="chkKit" value="checkbox" onChange="disp(this.checked)" onClick="disp(this.checked)" /></td>
</tr>

<tr>
<td align="right" valign="top" bgcolor="#D9D9D8" colspan="2">
<div id="ac01" style="display:none">
<table width="100%">
<tr><td align="center"><strong>Choisir les kits D&eacute;cor:</strong></td></tr>
<tr>
<td colspan="-2" align="left" bgcolor="#D9D9D8">

<table width="400" border="1" align="center" cellpadding="0" cellspacing="0">

<tr>
<td width="100%">Auvent & Boite &#224; fleur</td>
<td align="center"><input type="radio" name="rdoModel" onclick="showPorte(this.checked)" value="1"></td>
</tr>

<tr>
<td width="100%">Volet & Boite &#224; fleur</td>
<td align="center"><input type="radio" name="rdoModel" onclick="showPorte(this.checked)" value="2"></td>
</tr>

<tr>
<td width="100%">Volet & T&#234;te de fen&#234;tre</td>
<td align="center"><input type="radio" name="rdoModel" onclick="showPorte(this.checked)" value="3"></td>
</tr>

<tr>
<td width="100%">Volet & T&#234;te de fen&#234;tre & Boite &#224; fleur</td>
<td align="center"><input type="radio" name="rdoModel" onclick="showPorte(this.checked)" value="4"></td>
</tr>

<tr>
<td width="100%">Volet</td>
<td align="center"><input type="radio" name="rdoModel" onclick="showPorte(this.checked)" value="5"></td>
</tr>

<tr>
<td width="100%">T&#234;te de fen&#234;tre</td>
<td align="center"><input type="radio" name="rdoModel" onclick="showPorte(this.checked)" value="6"></td>
</tr>

<tr>
<td width="100%">T&#234;te de fen&#234;te & Boite &#224; fleur</td>
<td align="center"><input type="radio" name="rdoModel" onclick="showPorte(this.checked)" value="7"></td>
</tr>

</table>
<div id="porte" style="display:none">
<table width="400" border="1" align="center" cellpadding="0" cellspacing="0">
<tr><th colspan="4">Porte</th></tr>
<tr>
<td align="center" valign="top">&nbsp;</td>
<td valign="top" width="120" align="center"><strong>Mod&egrave;le:</strong></td>
<td valign="top" align="center"><strong>Apper&#231;u</strong></td>
</tr>

<tr>
<td align="center" valign="middle"><input type="radio" onclick="showKit(this.checked,633)" name="rdoKit2" value="633" /></td>
<td valign="middle">Porte 34 pas vitr&#233;</td>
<td align="center" valign="middle">&nbsp;</td>
</tr>

<tr>
<td align="center" valign="middle"><input type="radio" onclick="showKit(this.checked,635)" name="rdoKit2" value="635" /></td>
<td valign="middle">Porte 45 pas vitr&#233;</td>
<td align="center" valign="middle">&nbsp;</td>
</tr>

<tr>
<td align="center" valign="middle"><input type="radio" onclick="showKit(this.checked,636)" name="rdoKit2" value="636" /></td>
<td valign="middle">Porte 56 pas vitr&#233;</td>
<td align="center" valign="middle">&nbsp;</td>
</tr>

<tr>
<td align="center" valign="middle"><input type="radio" onclick="showKit(this.checked,637)" name="rdoKit2" value="637" /></td>
<td valign="middle">Porte 68 pas vitr&#233;</td>
<td align="center" valign="middle">&nbsp;</td>
</tr>

<tr>
<th colspan="3" align="center">
<strong>***Tout les KITS D&#201;COR INCLUS UNE GOUTTI&#200;RE***</strong>
</th>
</tr>
</table>
</td>
</tr>
</table>
</div>

<div id="633" style="display:none;">
<table width="400" border="1" align="center" cellpadding="0" cellspacing="0">
<tr><th>&nbsp;</th><th>Kit</th></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="715"></td><td>Kit Fen&#234;tre de porte demi fran&#231;aise 34''</td></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="716"></td><td>Kit Fen&#234;tre de porte fran&#231;aise 34''</td></tr>

</table>
</div>
<div id="635" style="display:none;">
<table width="400" border="1" align="center" cellpadding="0" cellspacing="0">
<tr><th>&nbsp;</th><th>Kit</th></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="717"></td><td>Kit Fen&#234;tre de porte demi jardin 45''</td></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="718"></td><td>Kit Fen&#234;tre de porte jardin 45''</td></tr>

</table>
</div>
<div id="636" style="display:none;">
<table width="400" border="1" align="center" cellpadding="0" cellspacing="0">
<tr><th>&nbsp;</th><th>Kit</th></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="719"></td><td>Kit Fen&#234;tre de porte demi jardin 56''</td></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="720"></td><td>Kit Fen&#234;tre de porte jardin 56''</td></tr>

</table>
</div>
<div id="637" style="display:none;">
<table width="400" border="1" align="center" cellpadding="0" cellspacing="0">
<tr><th>&nbsp;</th><th>Kit</th></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="721"></td><td>Kit Fen&#234;tre de porte demi jardin 68''</td></tr>

<tr><td align="center"><input type="radio" name="rdoKit3" value="722"></td><td>Kit Fen&#234;tre de porte jardin 68''</td></tr>
</table>
</div>
</div>
</td>
</tr>
</form>
<tr>
<td width="385" align="right" valign="top" bgcolor="#D9D9D8">&nbsp;</td>
<td colspan="-2" align="left" bgcolor="#D9D9D8"><div align="right">
<input type="button" name="Button" value="Suivant" onclick="validateNext(document.frmKit)" />
</div></td>
</tr>
</table>
<form name="frmK" method="POST" action="process.asp">
<input type="Hidden" name="kits" value="save">
<input type="Hidden" name="kits_c" value="open">
<input type="Hidden" name="bloc1" value="">
<input type="Hidden" name="bloc2" value="">
<input type="Hidden" name="bloc3" value="">
</form>

<script language="Javascript">

</script>


</td><td class="header3">&nbsp;</td>
</tr>
<tr><td colspan="3" align="right" class="header2">&nbsp;</td></tr>
</table>
</div>
</body>
</html>

LondonBoy
11-10-2006, 12:08 AM
nobody can help?

LondonBoy
11-10-2006, 02:55 AM
is there a problem with this line:

<input type="button" name="Button" value="Suivant" onclick="validateNext(document.frmKit)" />

Beagle
11-10-2006, 07:51 PM
First off, please put your code inside [ code][/code] tags (minus the space in the first tag. This will make it easier to read.

Second, please put the english translations of your javascript alerts so we know when it's asking you to make a selection. Right now, I have no idea which branch of code is executing.

And third, make sure that the javascript code in question is not one of the included files. If we need information from those included files, post each one of those in seperate code blocks.

Then we'll help. It's very difficult to read what you have there right now. (please make sure your indention carries over when you copy your code.)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum