Jump to content

Cyber_Star

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Cyber_Star

  • Rank
    Newbie
  1. Does anyone know about null pointer in java. for example : why we use String id = se.request.getParameter("id");......................if (("").equals(id) || ("null").equals(id)) {//some codes here}instead of usingif(id.equals("") || id.equals("null")) {//some codes here}Anyway, i need some clear explanations here. Thanks for helping.
  2. Hi thanks for your reply ...But what is the main reason causing this to happen? Anyway in my code, the "java" and "script" are not separated.I found out a solution to solve the problem as shown below. function ValidateRequired(field, alerttxt) { with(field) { if (value== null || value==""){ alert(alerttxt) return false; } else{ return true; } } } function ValidateAge(field, alerttxt) { with(field) { if(value==0) {alert(alerttxt) return false;} else{return true;} } } function validate_form(thisform){ with (thisform){ if(ValidateRequired(name, "Name field cannot be blank. Please enter your name!")==false) {name.focus();return false;} else if(ValidateAge(age, "Age cannot be zero! Please verify!")==false) {age.focus();return false;} } }
  3. Hi, I'm new to javascript. Here is the simple javascript that written for in the webpage.The process is to let user key in info and prompt them to enter info without leaving blank fields. My problem is, in firefox browser, user is being prompt to key in balnk fields but not in IE. I just dont know why it doesn't work in IE but it does work in firefox. Does anyone know why? Please help.Anyway, should i use another function in order to check the condition? for example: the JS form validation function goTest(action) { if (action=="checkNull"){ if (document.getElementById('name').value == null || document.getElementById('name').value == ""){ document.getElementById('name').focus(); alert('Name field cannot be blank. Please enter your name!') return false; } if (document.getElementById('age').value == null || document.getElementById('age').value == ""){ document.getElementById('age').focus(); alert('Please enter your age!') return false; } } return true; } This is the part for html that will call the function to check for null conditions in my webpage fields. <form name="edit" method="post" action="update.svdo" onsubmit="return goTest('checkNull')"> ......continue... <div align="center"> <input type="submit" value="Save Record " class="MFButton"> <input type='button' value=" Delete Record " onclick='go("Delete")'> <input type="button" value=" Back " class="MFButton" onClick="java script:document.location.href='main.tpl'"> <div>
×
×
  • Create New...