-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
72 lines (66 loc) · 2.36 KB
/
script.js
File metadata and controls
72 lines (66 loc) · 2.36 KB
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
66
67
68
69
70
71
72
$(document).ready(function(){
$('img').click(function() {
var id = $(this).attr('id');
window.location.href = "projectdetail.php?id="+id;
return false;
});
$("#addUpdate").hide();
$("#updatebtn").click(function(e) {
$("#addUpdate").show();
$("#updatebtn").hide();
});
$('.comment').keydown(function (e){
if (e.keyCode == 13) {
var projectid = $(this).attr('projectid');
var comment = $(this).val();
var posting = $.post('comment.php', { projectid: projectid, comment: comment });
posting.done(function( data ){
$('#comments').load('commentsdisplay.php?projectid='+projectid);
});
}
});
});
function validateForm() {
refreshErrors();
var title = document.forms["createproject"]["title"].value;
var minfund = document.forms["createproject"]["minfund"].value;
var maxfund = document.forms["createproject"]["maxfund"].value;
var category = document.forms["createproject"]["selectedcategory"].value;
var enddate = document.forms["createproject"]["enddate"].value;
var releasedate = document.forms["createproject"]["releasedate"].value;
flag = true;
if (title == "") {
document.getElementById('title').innerHTML="This field is required";
flag = false;
}
if (minfund == "") {
document.getElementById('minfund').innerHTML="This field is required";
flag = false;
}
if (maxfund == "") {
document.getElementById('maxfund').innerHTML="This field is required";
flag = false;
}
if (category == "" || category == "Select Category") {
document.getElementById('category').innerHTML="This field is required";
flag = false;
}
if (enddate == "") {
document.getElementById('enddate').innerHTML="This field is required";
flag = false;
}
if (releasedate == "") {
document.getElementById('releasedate').innerHTML="This field is required";
flag = false;
}
alert(flag)
return flag;
}
function refreshErrors() {
document.getElementById('title').innerHTML="";
document.getElementById('minfund').innerHTML="";
document.getElementById('maxfund').innerHTML="";
document.getElementById('category').innerHTML="";
document.getElementById('enddate').innerHTML="";
document.getElementById('releasedate').innerHTML="";
}