Dear forum members,
I'm trying to re-work on my web pages. Alas, my old form isn't working anymore...as in it used to be able to submit but now when I press submit, it just stall there.
Here's my java scripts and the form.
Hope someone can point me the way to make it submit...Thanks. Or if my javascript is outdated, please let me know where I can get easy plug-in code like jquery for java - preferably one with checkbox, radio buttons, drop down option etc.Code:<%@ page contentType="text/html; charset=UTF-8" %> <% String strCookieName = "serverMessage"; String strServerMessage = ""; Cookie objCookies[] = request.getCookies(); Cookie objCookie = null; if (objCookies != null) { for (int intIndex = 0; intIndex < objCookies.length; intIndex++) { if (objCookies[intIndex].getName().equals(strCookieName)) { objCookie = objCookies[intIndex]; strServerMessage = objCookie.getValue(); }//if }//for Cookie objKillMyCookie = new Cookie("serverMessage", ""); objKillMyCookie.setMaxAge(0); objKillMyCookie.setPath("/"); response.addCookie(objKillMyCookie); }//if %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Tutors Registration</title> <link rel="stylesheet" type="text/css" href="stylesheet.css" media="screen,projection" /> <link rel="stylesheet" style type ="text/css" href ="style.css"> <script language="javascript"> function checkForm(){ declare an empty Object variable. var objForm = new Object(); var objFullNameTextBox = new Object(); var objMessageBox = new Object(); var objAddress = new Object(); var strName = new String(""); objForm = document.getElementById("frmData"); objFullNameTextBox = document.getElementById("FullName"); objMessageBox = document.getElementById("divMessage"); objEmail = document.getElementById("Email"); strName = objName.value; strEmail = objEmail.value; strAddress = objAddress.value; strEmail = trimData(strEmail); strAddress = trimData(strAddress); strName = objFullNameTextBox.value; strName = trimData(strName); if (strName=="" ){ strMessage += "Please indicate Name<br>"; blnIsAllOkay = false; } if (strAddress=="" ){ strMessage += "Please indicate Address<br>"; blnIsAllOkay = false; } if (blnIsAllOkay==true){ objForm.submit(); }else{ objMessageBox.innerHTML = strMessage; } function trimData(pstrData){ var intIndex=0; var intRightIndex= pstrData.length -1; while((intIndex < pstrData.length) && (pstrData.charAt(intIndex) == ' ')) {intIndex++; } while((intRightIndex > intIndex) && (pstrData.charAt(intRightIndex) == ' ')) {intRightIndex-=1;} return pstrData.substring(intIndex, intRightIndex+1); } } function clearErr() { objMessageBox = document.getElementById("divMessage"); objMessageBox.innerHTML = ""; } </script> </head> <body> <div id="wrapper"> <div id="header"> <form id="frmData" name="frmData" action = "process" method = "post" > <table> <tr> <td>Full Name</td> <td><input type="text" id="FullName" name="FullName"></td> </tr> <tr> <td>Address</td> <td><input type="text" id="Address" name="Address" value=""></td> </tr> <tr> <td>Email</td> <td><input type="text" id="Email" name="Email" value=""></td> </tr> <td> <input type="button" id="btnSubmit" name="btnSubmit" value="Submit" onclick="checkForm()"/> <input id="reset" type="reset" name="reset" value="reset" onclick="clearErr();"/></td> </tr> </form>
Thanks.



Reply With Quote



Bookmarks