aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes facing problem while submitting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "facing problem while submitting" Watch "facing problem while submitting" New topic
Author

facing problem while submitting

sen senk
Greenhorn

Joined: Nov 16, 2011
Posts: 6
hi,

in my program if i click on submit button with out selecting any values then error msg is displaying,this is fine,but my page is refreshing how to restrict this.

function OnSubmitForm()
{
if(document.getElementById('userName1').value==0)
{

document.getElementById('sucessMessage').style.visibility = 'visible';
document.getElementById('sucessMessage').style.color = 'red';
document.getElementById('sucessMessage').innerHTML="Please select the user";
timeMsg();
return false;

}
else if(selObj.length==0 && check==0)
{
document.getElementById('sucessMessage').style.visibility = 'visible';
document.getElementById('sucessMessage').style.color = 'red';
document.getElementById('sucessMessage').innerHTML="Please Map the KRI Indicators";
timeMsg();
return false;
}

}

function timeMsg()
{
var t=setTimeout("disappearMsg()",8000);
}

function disappearMsg()
{

document.getElementById('sucessMessage').style.visibility = 'hidden';

}
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
Welcome to Ranch.

http://www.coderanch.com/how-to/java/CarefullyChooseOneForum


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Gautam Velpula
Greenhorn

Joined: Aug 04, 2008
Posts: 13
Have you tried to return false; outside the if - else -if statement?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: facing problem while submitting