i got for the 6 Scenario what i want to do 6 checkboxes:
<tr style="height: 21px;">
<td style="width: 25%; height: 21px;">COB</td>
<td style="width: 25%; height: 21px;"><input name="COB" type="checkbox" id="COB" value="1" <?php if($_GET['COB'] == '1'){ echo 'checked="checked"';}?>/> </td>
<td style="width: 25%; height: 21px;">SMT</td>
<td style="width: 25%; height: 21px;"> <input name="SMT" id="SMT" type="checkbox" value="1" <?php if($_GET['SMT'] == '1'){ echo 'checked="checked"';}?>/> </td>
</tr>
<tr style="height: 21px;">
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;">BGA</td>
<td style="width: 25%; height: 21px;"> <input name="BGA" id="BGA" type="checkbox" value="1" <?php if($_GET['BGA'] == '1'){ echo 'checked="checked"';}?>/> </td>
</tr>
<tr style="height: 21px;">
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;"> TSOP Typ 1 </td>
<td style="width: 25%; height: 21px;"><input name="TSOP" id="TSOP" type="checkbox" value="1"<?php if($_GET['TSOP'] == '1'){ echo 'checked="checked"';}?> /></td>
</tr>
<tr style="height: 21px;">
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;"> TSOP Typ 2</td>
<td style="width: 25%; height: 21px;"><input name="TSOP" id="TSOP" type="checkbox" value="2"<?php if($_GET['TSOP'] == '2'){ echo 'checked="checked"';}?> /> </td>
</tr>
<tr style="height: 21px;">
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;"></td>
<td style="width: 25%; height: 21px;"> LGA</td>
<td style="width: 25%; height: 21px;"><input name="LGA" id="LGA" type="checkbox" value="1"<?php if($_GET['LGA'] == '1'){ echo 'checked="checked"';}?> /> </td>
</tr>
And here the PHP Part how i populate the Dropdown.
<td style="width: 14.2857%; height: 21px;"> <select id="FlashID" name="FlashID" onchange="FlashFunction()" size="1" >
<option disabled selected value> </option>;
<?php
foreach($connection->query($flash) as $m)
{
if($m['FlashID'] == $_GET['FlashID']){
$isSelected = 'selected="selected"';
}else{
$isSelected = '';
}
echo "<option data-COB='".$m['COB']."' data-SMT='".$m['SMT']."' data-BGA='".$m['BGA']."' data-TSOP='".$m['TSOP']."' data-LGA='".$m['LGA']."' value='" . $m['FlashID'] . "'".$isSelected." >" .$m['SAP'] ."</option>";
}
?>
</td>
Here is the SQL Table for the poplated Dropdown
FlashID SAP COB SMT BGA TSOP LGA
1 102292 0 1 0 2 0
3 102293 0 1 0 2 0
4 102294 0 1 0 2 0
5 102296 0 1 0 0 1
6 102412 0 1 0 1 0
7 102413 0 1 0 1 0
8 102414 0 1 0 1 0
9 102651 0 1 0 2 0
10 102652 0 1 0 2 0
11 102664 0 1 0 2 0
This is my not working Javascript Part:
<script>
function FlashFunction(){
var index = document.getElementById("FlashID").selectedIndex;
var COB = document.getElementById("FlashID").options[index].getAttribute("data-COB");
var SMT = document.getElementById("FlashID").options[index].getAttribute("data-SMT");
var BGA = document.getElementById("FlashID").options[index].getAttribute("data-BGA");
var TSOP = document.getElementById("FlashID").options[index].getAttribute("data-TSOP");
var LGA = document.getElementById("FlashID").options[index].getAttribute("data-LGA");
document.getElementsByName("COB")[0].value = COB;
document.getElementsByName("SMT")[0].value = SMT;
document.getElementsByName("BGA")[0].value = BGA;
document.getElementsByName("TSOP")[0].value = TSOP;
document.getElementsByName("LGA")[0].value = LGA;
}
</script>
Notice the TSOP can be value 1 or 2.
for ex. You see already if I select FlashID 6. TSOP and SMT Checkbox should be checked.
But atm I have no idea, how I can handle this in why my Javascript is not working Can someone help?
Aucun commentaire:
Enregistrer un commentaire