Skip to content

Commit

Permalink
#48 form editor, not yet integrated into the app
Browse files Browse the repository at this point in the history
  • Loading branch information
shrfarzk committed May 1, 2015
1 parent 12aef8f commit 90f2c34
Show file tree
Hide file tree
Showing 3 changed files with 9,257 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Form editor/formeditor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>Editor</title>
<script src="jquery.js"></script>
<script src="formeditor.js"></script>
</head>
<body>
<p id="original" hidden></p>
<div>
<textarea id="new"></textarea>
<button onclick="addNew();">Add</button>
</div>
<div>
<ol id="cells">
</ol>
</div>
<div>
<button onclick="submit();">submit</button>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions Form editor/formeditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var lines = "";
var count = 0;

function recordAll() {
lines = "";
$('#cells').children().each(function(){lines += $(this).find('span').text()+"|#|";});
}

function submit() { //edit
recordAll();
// var request = new XMLHttpRequest()
alert(lines.toString());
}

function addNew() {
if ($('#new').val()) {
$('#cells').append('<li id="q'+count+'"><button onclick="deletethis(q'+count+');"> x</button><span>'+$('#new').val()+'</span></li>');
$('#new').val("");
count++;
}
}

function deletethis(x) {
$(x).remove();
}

function init() {
var original = $('#original').text().split('|#|');
original.pop();
}
Loading

0 comments on commit 90f2c34

Please sign in to comment.