Hi everyone, i have a problem here that i'm not sure how to solve it.
I have the following javascript to check that it is not empty and it is not more than 2000 characters.
function confirmSubmit()
{
var obj = document.ResearchPaperForm;
var check = false;
if (obj.summary.value == ''){
summary.innerHTML = "<span class=fail><bean:message key="alert.msg.publisher.summary.required"/></span>"
obj.summary.focus();
check = false;
}
if (obj.summary.value.length > 2000){
summary.innerHTML = "<span class=fail><bean:message key="alert.msg.publisher.summary.exceed"/></span>"
obj.summary.focus();
check = false;
}else {
check = true;
}
if (check) {
var r = confirm("<bean:message key="alert.msg.publisher.confirm.publish"/>")
if (r)
{
document.ResearchPaperForm.submit();
}
else
{
check = false;
}
}
}
When i checked for empty fields, it's ok. But when i checked more than 2000 characters, it can detect the error but when i click submit, it still pop up the confirmation message even when it indicate the field cannot be more than 2000 characters. How do i prevent it? Anyone knows. Please help. Thank you.
I have another question. If i want to validate the attachment filesize cannot be more than 10MB, how do i do it? Thanks!