Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions
You are not logged in.
Pages: 1
In a jsp form validation page, I am checking whether a name is already exists or not.If it exists ,a suitable message is displaying, saying "Name already exists!!".
But inspite of that message ,the form is submitting if i click the submit button.
I'm a newbie to jquery, please help.
This is my js page:
function groupValidator() {
var fv = true;
var groupNamereg = /^[a-zA-Z]+[\d ]*[\w ]*$/;
var grpName = document.getElementById('groupName').value;
var link = document.getElementsByName("link");
if (!grpName.trim().match(groupNamereg)) {
document.getElementById('gnError').innerHTML = "Group Name cannot have only numbers or special characters";
fv = false;
}
if (grpName == "" || grpName == null) {
document.getElementById('gnError').innerHTML = "Group Name cannot be empty";
fv = false;
}
$('#groupName').blur(
function(event) {
var name = document.getElementById('groupName').value;
var className = 'Group';
$.get("checkNameExistence?name=" + name + "&className="
+ className, function(responseText,status) {
alert(responseText);
alert(fv);
if(responseText.trim() == ""){
}else{
fv = false;
$("#gnError").text(responseText);
alert(">>> : "+fv); //Here fv is false
}
});
});
if (link[0].checked == false && link[1].checked == false) {
document.getElementById('linkError').innerHTML = "Please select link type";
fv = false;
}
alert(">>> fsdfsdff : "+fv); // But how come here it changes to true
return fv;
}
Offline
Hi Radhika,
welcome in the live helper chat support forum!
Here the support is limited and free about basic functions or questions.
Seems you need customize something and I think you will not find any help regarding this here as I cannot provide support about this.
There is maybe two way you can take,
the first is asking in some forum on the web where developers can help you,
the second is consider to ask for the commercial support: you can find more info regarding this on my forum signature.
Welcome on board and thank you for your interest in the live helper chat project!
PeopleInside - Live helper chat - free limited forum support!
For commercial support or GitHub [see FAQ here]
If you want to support this open source project, just donate [see support page]
Something wrong with the forum? [contact a superhero]
Offline
Pages: 1