Bug Tracker

Opened 8 years ago

Closed 8 years ago

#8793 closed bug (invalid)

javascript problem

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

<?xml version="1.0" encoding="utf-8" ?>

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 StrictEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"> <head>

<title>EKU</title>

<script type="text/javascript"> <![CDATA[

function valStudent() {

var lastName = document.frmStudentInfo.txtLastName.value; var firstname = document.frmStudentInfo.txtFirstName.value; var mi = document.frmStudentInfo.txtS_Mi.value; var address = document.frmStudentInfo.txtS_Add.value; var city = document.frmStudentInfo.txtS_City.value; var state = document.frmStudentInfo.txtS_State.value; var zip = document.frmStudentInfo.txtS_Zip.value; var phone = document.frmStudentInfo.txtS_Phone.value;

var dob = new Date (document.frmStudentInfo.txtS_Dob.value);

var selectAdvisor = document.frmStudentInfo.lstF_ID.selectIndex; var res = document.frmStudentInfo.chkResident.value; var stuClass; var classChecked = false;

for (var i=0; i < document.frmStudentInfo.optS_Class.length; i++)

{

if (document.frmStudentInfo.optS_Class[i].checked) {

classChecked = true; stuClass = document.frmStudentInfo.optS_Class[i].value;

} };

if (lastName == "") {

alert ("Please enter a last name"); document.frmStudentInfo.txtLastName.select(); return false;

} else if (firstname == "") {

alert ("Please enter a first name"); document.frmStudentInfo.txtFirstName.select(); return false;

}else if (address == "") {

alert ("Please enter a address"); document.frmStudentInfo.txtS_Add.select(); return false;

} else if (city == "") {

alert ("Please enter a city"); document.frmStudentInfo.txtS_City.select(); return false;

} else if (state == "") {

alert ("Please enter a state"); document.frmStudentInfo.txtS_State.select(); return false;

} else if (zip == "") {

alert ("Please enter a zip"); document.frmStudentInfo.txtS_Zip.select(); return false;

} else if (phone == "") {

alert ("Please enter a phone"); document.frmStudentInfo.txtS_Phone.select(); return false;

}else if(dob == "NaN") { alert ("Date of Birth is not valid, use MM/DD/YYYY to enter data"); document.frmStudentInfo.txtS_Dob.select();

return false;

} else {

alert ("Last name: " + lastName + "\n" + "First Name: " + firstname + "\n" +

"mi" + mi + "\n" +"Address: " + address + "\n" + "City: " + city + "\n" + "State: " + state + "\n" + "Zip: " + zip + "\n" + "phone: " + phone + "\n" +

"Date of Birth: " + dob + "\n" + "Advisor " +

document.frmStudentInfo.lstF_ID.text(selectAdvisor).text + "\n" + "classfication "

+ stuClass);

return true;

}

}

]]> </script> </head> <body> <table width="70%" align="center">

<tr> <td><img src="nwlogo.jpg" width="196" height="93" alt=" PLEASE DESCRIBE THIS IMAGE " /></td> <td> <h2>Student Information</h2> </td> </tr> </table> <form name="frmStudentInfo" action="action%20marker" id="frmStudentInfo"> <table align="center"> <tr> <td> Last Name:</td> <td><input type="text" name="txtLastName" size="20" /></td> <td></td> <td> </td> <td> <h4>Class:</h4> </td> <td></td> </tr> <tr> <td> First Name:</td> <td><input type="text" name="txtFirstName" size="20" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Freshman" /></td> <td>Freshman</td> </tr> <tr> <td> MI:</td> <td><input type="text" name="txtS_Mi" size="5" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Sophomore" /></td> <td>Sophomore</td> </tr> <tr> <td> Address:</td> <td><input type="text" name="txtS_Add" size="20" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Junior" /></td> <td>Junior</td> </tr> <tr> <td> City:</td> <td><input type="text" name="txtS_City" size="20" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Senior" /></td> <td>Senior</td> </tr> <tr> <td> State:</td> <td><input type="text" name="txtS_State" size="5" /></td> <td> </td> <td><input type="radio" name="optS_Class" value="Graduate" /></td> <td>Graduate</td> </tr> <tr> <td> ZIP Code:</td> <td><input type="text" name="txtS_Zip" size="20" /></td> <td> </td> <td></td> <td></td> </tr> <tr> <td> Phone:</td> <td><input type="text" name="txtS_Phone" size="20" /></td> <td> </td> <td>:<input name="chkResident" type="checkbox" /></td> <td> Kentucky Resident</td> </tr> <tr> <td> Date of Birth:</td> <td><input type="text" name="txtS_Dob" size="20" /></td> <td> </td> <td>Advisor</td> <td><select size="1" name="lstF_ID"> <option selected="selected">1 (Chuck Lin)</option> <option>2 (Chris Blades)</option> <option>3 (Steve Loy)</option> <option>4 (Bob Mahaney)</option> <option>5 (Ted Randles)</option> </select></td> </tr> <tr> <td></td> <td><input type="submit" value="Submit" onclick="valStudent()" /></td> </tr> </table> </form> </body> </html>

Change History (2)

comment:1 Changed 8 years ago by Rick Waldron

Owner: set to anonymous
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.

comment:2 Changed 8 years ago by addyosmani

Resolution: invalid
Status: pendingclosed

Thanks for submitting a ticket to the jQuery Bug Tracker. Unfortunately, it doesn't appear that your code includes any form of jQuery, just vanilla JavaScript. This tracker is for jQuery core issues only. For assistance with JavaScript specific issues, I recommend posting a question regarding your code on StackOverflow as they may be able to assist further.

Note: See TracTickets for help on using tickets.