Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mycsvdata.csv

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@
opacity: 1;
visibility: visible;
}

.btnloadcsv {
display: flex;
align-items: center;
}

.btnloadcsv {

display: flex;
padding: 30px;
margin-right: 10px;
margin-left: 10px;
}

.btnloadcsv btn-csv {
padding: 20px;
margin-right: 20px;
}

/* Styles for the content section */

Expand Down Expand Up @@ -337,6 +355,13 @@ <h3 style="font-family: 'Balsamiq Sans', cursive;">Some Symptoms of Breast Cance
</div>
</div>
</form>

<div class="btnloadcsv">
<!-- <div class="col-sm-10"> -->
<input class="btn-csv btn-upload-csv btn-primary" type="file" id="file" name="Upload CSV" accept=".csv">
<input class="btn-csv btn-read-csv btn-primary" id="btn-read-csv" type="button" name="Load CSV" value="Submit" onclick="readCSVFile();" >
<!-- </div> -->
</div>

</div>

Expand Down Expand Up @@ -364,6 +389,22 @@ <h3 style="font-family: 'Balsamiq Sans', cursive;">Some Symptoms of Breast Cance
$('html, body').animate({scrollTop:0}, '300');
});

function readCSVFile() {
var fileInput = document.getElementById('file');
var file = fileInput.files[0];
var fileName = file.name;

fetch("../" + fileName).then(res => {
return res.text();
}).then(data => {
console.log(data);
var values = data.split(',');
for (let i = 1; i <= 30; i++) {
document.getElementById("value"+i).value = values[(i-1)].trim();
}

});
}

</script>
</body>
Expand Down