forked from rDrama/rDrama
fds
parent
3e13a673e8
commit
29f215a500
|
@ -8,7 +8,7 @@
|
|||
<script src="/assets/js/general39.js"></script>
|
||||
|
||||
|
||||
<!-- <script>
|
||||
<script>
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
document.getElementById('submitform').submit(function() {
|
||||
|
@ -190,50 +190,50 @@
|
|||
|
||||
// Submit Page Front-end Validation
|
||||
|
||||
function checkForRequired() {
|
||||
// function checkForRequired() {
|
||||
|
||||
// Divs
|
||||
// // Divs
|
||||
|
||||
var title = document.getElementById("post-title");
|
||||
// var title = document.getElementById("post-title");
|
||||
|
||||
var url = document.getElementById("post-URL");
|
||||
// var url = document.getElementById("post-URL");
|
||||
|
||||
var text = document.getElementById("post-text");
|
||||
// var text = document.getElementById("post-text");
|
||||
|
||||
var button = document.getElementById("create_button");
|
||||
// var button = document.getElementById("create_button");
|
||||
|
||||
var image = document.getElementById("file-upload");
|
||||
// var image = document.getElementById("file-upload");
|
||||
|
||||
// Toggle reuqired attribute
|
||||
// // Toggle reuqired attribute
|
||||
|
||||
if (url.value.length > 0 || image.value.length > 0) {
|
||||
text.required = false;
|
||||
url.required=false;
|
||||
} else if (text.value.length > 0 || image.value.length > 0) {
|
||||
url.required = false;
|
||||
} else {
|
||||
text.required = true;
|
||||
url.required = true;
|
||||
}
|
||||
// if (url.value.length > 0 || image.value.length > 0) {
|
||||
// text.required = false;
|
||||
// url.required=false;
|
||||
// } else if (text.value.length > 0 || image.value.length > 0) {
|
||||
// url.required = false;
|
||||
// } else {
|
||||
// text.required = true;
|
||||
// url.required = true;
|
||||
// }
|
||||
|
||||
// Validity check
|
||||
// // Validity check
|
||||
|
||||
var isValidTitle = title.checkValidity();
|
||||
// var isValidTitle = title.checkValidity();
|
||||
|
||||
var isValidURL = url.checkValidity();
|
||||
// var isValidURL = url.checkValidity();
|
||||
|
||||
var isValidText = text.checkValidity();
|
||||
// var isValidText = text.checkValidity();
|
||||
|
||||
// Disable submit button if invalid inputs
|
||||
// // Disable submit button if invalid inputs
|
||||
|
||||
if (isValidTitle && (isValidURL || image.value.length>0)) {
|
||||
button.disabled = false;
|
||||
} else if (isValidTitle && isValidText) {
|
||||
button.disabled = false;
|
||||
} else {
|
||||
button.disabled = true;
|
||||
}
|
||||
}
|
||||
// if (isValidTitle && (isValidURL || image.value.length>0)) {
|
||||
// button.disabled = false;
|
||||
// } else if (isValidTitle && isValidText) {
|
||||
// button.disabled = false;
|
||||
// } else {
|
||||
// button.disabled = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// markdown
|
||||
|
@ -253,7 +253,7 @@
|
|||
|
||||
}
|
||||
|
||||
</script> -->
|
||||
</script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
|
|
Loading…
Reference in New Issue