diff options
author | Hannes "Brolaugh" Kindströmmer <me@brolaugh.com> | 2016-03-17 00:09:48 +0100 |
---|---|---|
committer | Hannes "Brolaugh" Kindströmmer <me@brolaugh.com> | 2016-03-17 00:09:48 +0100 |
commit | d0ba22a0356eb80fbc72474e98f69dc7c3cf545e (patch) | |
tree | 315af0e9b4f58ee2104d17006194d52d2b8a57d6 | |
parent | 9af10c3cfdc33c743a0b4ff01f754fae76749634 (diff) | |
download | tasklist-php-d0ba22a0356eb80fbc72474e98f69dc7c3cf545e.zip tasklist-php-d0ba22a0356eb80fbc72474e98f69dc7c3cf545e.tar.gz tasklist-php-d0ba22a0356eb80fbc72474e98f69dc7c3cf545e.tar.bz2 |
Tasks are now submitted with javascript
-rw-r--r-- | App/pages/dashboard.php | 12 | ||||
-rw-r--r-- | js/master.js | 16 |
2 files changed, 21 insertions, 7 deletions
diff --git a/App/pages/dashboard.php b/App/pages/dashboard.php index 3be4f1b..85e00b5 100644 --- a/App/pages/dashboard.php +++ b/App/pages/dashboard.php @@ -55,25 +55,25 @@ </div> <div class="col-md-6"> <div class="well"> - <form class="form-horizontal" role="form" action="App/formhandler/add_listitem.php" method="post"> + <form class="form-horizontal" action="javascript:addTask()" method="post"> <fieldset> <div class="form-group"> <label for="tasktitle" class="control-label col-md-2">Uppgift</label> <div class="col-md-10"> - <input type="text" name="tasktitle" placeholder="Uppgiftstitel" class="form-control" required="required"> + <input type="text" name="tasktitle" id="tasktitle" placeholder="Uppgiftstitel" class="form-control" required="required"> </div> </div> <div class="form-group"> <label for="taskbody" class="control-label col-md-2">Detalj</label> <div class="col-md-10"> - <textarea name="taskbody" rows="3" class="col-md-10 col-sm-10 col-xs-12 form-control" + <textarea name="taskbody" id="taskbody" rows="5" class="col-md-10 col-sm-10 col-xs-12 form-control" placeholder="Detaljer"></textarea> </div> </div> <div class="form-group"> <label for="person" class="control-label col-md-2">Person</label> <div class="col-md-10"> - <input type="text" name="taskperson" placeholder="Person" class="form-control" required="required"> + <input type="text" name="taskperson" id="taskperson" placeholder="Person" class="form-control" required="required"> </div> </div> <div class="form-group col-md-offset-2 col-md-10"> @@ -109,7 +109,7 @@ if ($task->level != $tl->plain_text) { ?> <li data-toggle="modal" data-target="#statusmodal" onclick="javascript:modalFix(<?php echo $task->id . "," . $tl->id . ",'" . $task->title."'";?>)"> - <span class="text-<?php echo $tl->style_class; ?>"><?php echo $tl->plain_text; ?></span> + <span class="text-<?php echo $tl->style_class; ?>"><?php echo $tl->plain_text; ?></span> </li> <?php } @@ -152,7 +152,7 @@ </div> </div> </fieldset> - </form> + </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" onclick="changeStatus();">Ändra status</button> diff --git a/js/master.js b/js/master.js index 827f839..eaf5866 100644 --- a/js/master.js +++ b/js/master.js @@ -1,5 +1,4 @@ var title, status, task; -UpdateTaskVisuals(18); function modalFix(task_s, status_s, title_s){ document.getElementById("modal-title").value = title_s; title = title_s; @@ -10,6 +9,21 @@ function modalFix(task_s, status_s, title_s){ console.log("modalFix"); } +function addTask(){ + var xmlhttp = new XMLHttpRequest(); + var tasktitle = document.getElementById("tasktitle").value; + var taskbody = document.getElementById("taskbody").value; + var taskperson = document.getElementById("taskperson").value; + console.log("Häre är jag!"); + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + + } + }; + xmlhttp.open("POST", "App/formhandler/add_listitem.php", true); + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.send("tasktitle="+tasktitle+"&taskbody="+taskperson+"&taskperson"+taskperson); +} function changeStatus(){ var xmlhttp = new XMLHttpRequest(); var user = document.getElementById("modalname").value; |