document.getElementById werkt niet
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<script type="text/javascript">
function myFunction(){
var lblValue = document.getElementById("Invoerer");
lblValue.innerHTML = "<input type='text' name='Invoerer' id='user' value=<?php echo $Invoerer; ?>><input type='hidden' name='ids' id='ids' value='<?php echo $_GET[id]; ?>'>";
var lblValue = document.getElementById("SendUser");
lblValue.innerHTML = "<button type='submit' class='btn btn-primary' onclick='SaveInvoerer();'>Opslaan</button>";
}
function myFunctions(){
var lblValue = document.getElementById("StatusField");
lblValue.innerHTML = "<select name='State' id='State'><option value='Nieuw'>Nieuw</option><option value='Meer informatie Vereist'>Meer informatie Vereist</option><option value='Devlopment'>Devlopment</option><option value='Geen Bug'>Geen Bug</option><option value='Nieuw'>Nieuw</option><option value='Duplicaat'>Duplicaat</option><option value='Opgelost'>Opgelost</option></select>";
var lblValue = document.getElementById("Status");
lblValue.innerHTML = "<button type='submit' class='btn btn-primary' onclick='SaveStatus();'>Opslaan</button>";
}
function SaveStatus(){
alert("Test1");
var ids = document.getElementById("ids");
var status = document.getElementById("status");
alert(ids);
alert(status);
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
$("#ViewState").slideUp('slow');
$("#ViewState").slideDown('slow');
}
}
xmlhttp.open("GET","Bugs_Wijzigen.php?Bug=" + ids + "&Actie=StatusChange&status=" + status + "&Save=Ja",true);
xmlhttp.send();
}
function SaveInvoerer(){
$("#ViewSave").slideUp('slow');
$("#ViewSave").slideDown('slow');
var ids = document.getElementById("ids").value;
var name = document.getElementById("user").value;
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
}
}
xmlhttp.open("GET","Bugs_Wijzigen.php?Bug=" + ids + "&Actie=InvoererChange&name=" + name + "&Save=Ja",true);
xmlhttp.send();
}
</script>
function myFunction(){
var lblValue = document.getElementById("Invoerer");
lblValue.innerHTML = "<input type='text' name='Invoerer' id='user' value=<?php echo $Invoerer; ?>><input type='hidden' name='ids' id='ids' value='<?php echo $_GET[id]; ?>'>";
var lblValue = document.getElementById("SendUser");
lblValue.innerHTML = "<button type='submit' class='btn btn-primary' onclick='SaveInvoerer();'>Opslaan</button>";
}
function myFunctions(){
var lblValue = document.getElementById("StatusField");
lblValue.innerHTML = "<select name='State' id='State'><option value='Nieuw'>Nieuw</option><option value='Meer informatie Vereist'>Meer informatie Vereist</option><option value='Devlopment'>Devlopment</option><option value='Geen Bug'>Geen Bug</option><option value='Nieuw'>Nieuw</option><option value='Duplicaat'>Duplicaat</option><option value='Opgelost'>Opgelost</option></select>";
var lblValue = document.getElementById("Status");
lblValue.innerHTML = "<button type='submit' class='btn btn-primary' onclick='SaveStatus();'>Opslaan</button>";
}
function SaveStatus(){
alert("Test1");
var ids = document.getElementById("ids");
var status = document.getElementById("status");
alert(ids);
alert(status);
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
$("#ViewState").slideUp('slow');
$("#ViewState").slideDown('slow');
}
}
xmlhttp.open("GET","Bugs_Wijzigen.php?Bug=" + ids + "&Actie=StatusChange&status=" + status + "&Save=Ja",true);
xmlhttp.send();
}
function SaveInvoerer(){
$("#ViewSave").slideUp('slow');
$("#ViewSave").slideDown('slow');
var ids = document.getElementById("ids").value;
var name = document.getElementById("user").value;
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
}
}
xmlhttp.open("GET","Bugs_Wijzigen.php?Bug=" + ids + "&Actie=InvoererChange&name=" + name + "&Save=Ja",true);
xmlhttp.send();
}
</script>
De functies myFunction(){ en myFunctions(){ werken prima, even als function SaveInvoerer(){
Echter wilt function SaveStatus(){ niet werken. Deze wilde ik debuggen, maar komt er echt nietmeer uit.
Zoals het nu is krijg ik de volgende waardes:
Test1
null
null
Als ik
var ids = document.getElementById("ids");
var status = document.getElementById("status");
Verander in:
var ids = document.getElementById("ids").value;
var status = document.getElementById("status").value;
Krijg ik Test1 en daarna niks meer.
Script boven het bovenstaande javascript:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<div class="row">
<div class="col-lg-12">
<div class="alert alert-dismissable alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Bekijken</strong> Je bekijkt nu de bug met ID '<?php echo $id; ?>'
</div>
</div>
<script type="text/javascript" language="javascript" src="table/media/js/jquery.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
<?php
$se = mysql_query("SELECT * FROM bugs WHERE ID='".mysql_real_escape_string($_GET['id'])."'")or die(mysql_error());
$se2 = mysql_num_rows(mysql_query("SELECT * FROM bugs_reacties WHERE Bug_ID='".mysql_real_escape_string($_GET['id'])."' AND Rep = '1'"));
while($row = mysql_fetch_array($se)){
$Omschrijving = $row['Omschrijving'];
$Onderwerp = $row['Onderwerp'];
$Datum = $row['Ingevoerd'];
$Invoerer = $row['Invoerer'];
$Versie = $row['Versies'];
$Browser = $row['Browsers'];
$Prio = $row['Prioriteit'];
$Status = $row['Status'];
}
?>
<div class="col-lg-12">
<div class="alert alert-dismissable alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Bekijken</strong> Je bekijkt nu de bug met ID '<?php echo $id; ?>'
</div>
</div>
<script type="text/javascript" language="javascript" src="table/media/js/jquery.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
<?php
$se = mysql_query("SELECT * FROM bugs WHERE ID='".mysql_real_escape_string($_GET['id'])."'")or die(mysql_error());
$se2 = mysql_num_rows(mysql_query("SELECT * FROM bugs_reacties WHERE Bug_ID='".mysql_real_escape_string($_GET['id'])."' AND Rep = '1'"));
while($row = mysql_fetch_array($se)){
$Omschrijving = $row['Omschrijving'];
$Onderwerp = $row['Onderwerp'];
$Datum = $row['Ingevoerd'];
$Invoerer = $row['Invoerer'];
$Versie = $row['Versies'];
$Browser = $row['Browsers'];
$Prio = $row['Prioriteit'];
$Status = $row['Status'];
}
?>
Script onder de bovenste Javascript:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!-- General Information --><div class="row" width="95%"><div class="col-lg-12" width="95%"><div width="95%" class="table-responsive"><table class="table table-bordered table-hover tablesorter" width="95%"><tbody><tr><td width="15%"><b>Invoerder</b></td>
<td width="70%"><div id="Invoerer"><?php echo $Invoerer; ?></div></td>
<td width="15%"><div id="SendUser"><button type="submit" class="btn btn-primary" onclick="myFunction();">Bewerk</button></div></td>
</tr>
<tr id="ViewSave" style="display: none"><td colspan='3' style='background-color:lightgreen;'>Opgeslagen!</td></tr>
<tr>
<td width="15%"><b>Datum</b></td>
<td width="70%"><?php echo $Datum; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Versie</b></td>
<td width="70%"><?php echo $Versie; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Gereproduceerd</b></td>
<td width="70%"><?php echo $se2; ?>x</td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Browser</b></td>
<td width="70%"><?php echo $Browser; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Prioriteit</b></td>
<td width="70%"><?php echo $Prio; ?></td>
<td width="15%"><button type="submit" class="btn btn-primary">Bewerk</button></td>
</tr>
<tr>
<td width="15%"><b>Premium/Scripts</b></td>
<td width="70%">
1: , 2: , 3: , 4: , 5: , S: </td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary" id="submit_button" name="submit_button">Bewerk</button></fieldset>
</td>
</tr>
<tr>
<td width="15%"><b>Status</b></td>
<td width="70%"><div id="StatusField"><?php echo $Status; ?></div></td>
<td width="15%"><div id="Status"><button type="submit" class="btn btn-primary" onclick="myFunctions();">Bewerk</button></div>
</td></tr>
<tr id="ViewState" style="display: none"><td colspan='3' style='background-color:lightgreen;'>Opgeslagen!</td></tr>
<tr>
<td width="15%"><b>Onderwerp</b></td>
<td><?php echo $Onderwerp; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary" id="submit_button" name="submit_button">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Omschrijving</b></td>
<td width="70%"><?php echo $Omschrijving; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary" id="submit_button" name="submit_button">Bewerk</button></fieldset></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<td width="70%"><div id="Invoerer"><?php echo $Invoerer; ?></div></td>
<td width="15%"><div id="SendUser"><button type="submit" class="btn btn-primary" onclick="myFunction();">Bewerk</button></div></td>
</tr>
<tr id="ViewSave" style="display: none"><td colspan='3' style='background-color:lightgreen;'>Opgeslagen!</td></tr>
<tr>
<td width="15%"><b>Datum</b></td>
<td width="70%"><?php echo $Datum; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Versie</b></td>
<td width="70%"><?php echo $Versie; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Gereproduceerd</b></td>
<td width="70%"><?php echo $se2; ?>x</td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Browser</b></td>
<td width="70%"><?php echo $Browser; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Prioriteit</b></td>
<td width="70%"><?php echo $Prio; ?></td>
<td width="15%"><button type="submit" class="btn btn-primary">Bewerk</button></td>
</tr>
<tr>
<td width="15%"><b>Premium/Scripts</b></td>
<td width="70%">
1: , 2: , 3: , 4: , 5: , S: </td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary" id="submit_button" name="submit_button">Bewerk</button></fieldset>
</td>
</tr>
<tr>
<td width="15%"><b>Status</b></td>
<td width="70%"><div id="StatusField"><?php echo $Status; ?></div></td>
<td width="15%"><div id="Status"><button type="submit" class="btn btn-primary" onclick="myFunctions();">Bewerk</button></div>
</td></tr>
<tr id="ViewState" style="display: none"><td colspan='3' style='background-color:lightgreen;'>Opgeslagen!</td></tr>
<tr>
<td width="15%"><b>Onderwerp</b></td>
<td><?php echo $Onderwerp; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary" id="submit_button" name="submit_button">Bewerk</button></fieldset></td>
</tr>
<tr>
<td width="15%"><b>Omschrijving</b></td>
<td width="70%"><?php echo $Omschrijving; ?></td>
<td width="15%"><fieldset disabled><button type="submit" class="btn btn-primary" id="submit_button" name="submit_button">Bewerk</button></fieldset></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
Hoofdletter en kleine letter.
<input type='hidden' name='ids' id='ids' value=''>
Werkt nu, top!