User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 375,238 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,145 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1090 | Replies: 3 | Solved
Reply
Join Date: Mar 2008
Posts: 169
Reputation: Traicey is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 16
Traicey's Avatar
Traicey Traicey is offline Offline
Junior Poster

Help ALERT and JAVA Script

  #1  
Mar 20th, 2008
I have a program that suppose to print out a student information so I have to use Alert in order to make this a success but my JAVA SCRIPT is not producing anything, I dont know what Im missing in my code please have a look at it.... its quite bit long but please be pacient with me

<script language="javascript">
		<!--
		  function validateInput()
		  {
		      var LName = document.frmStudentInfo.txtLastName.value;
              var FName = 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 lstInx = document.frmStudentInfo.lstF_ID.selectedIndex;
              var radValue;
              var checkedBox = "NO";
              var radChecked = false;
              
              for(var i = 0;i < document.frmStudentInfo.optS_Class.length;i++)
              {
                if(document.frmStudentInfo.optS_Class[i].checked)
                   {
                     radValue = document.frmStudentInfo.optS_Class[i].value;
                     radChecked = true;
                   }
              }
               
              if(document.frmStudentInfo.txtLastName.value == "")
               {
                 alert("Please enter last name");
                 document.frmStudentInfo.txtLastName.select();
                 return false;
               } 
              else if(document.frmStudentInfo.txtFirstName.value == "")
               {
                 alert("Please enter first name");
                 document.frmStudentInfo.txtFirstName.select();
                 return false;
               }
              else if(document.frmStudentInfo.txtS_Mi.value == "")
               {
                 alert("Please enter MI");
                 document.frmStudentInfo.txtS_Mi.select();
                 return false;
               }
              else if(document.frmStudentInfo.txtS_Add.value == "")
               {
                 alert("Please enter address");
                 document.frmStudentInfo.txtS_Add.select();
                 return false;
               }
               else if(document.frmStudentInfo.txtS_City.value == "")
               {
                 alert("Please enter city");
                 document.frmStudentInfo.txtS_City.select();
                 return false;
               }
               else if(document.frmStudentInfo.txtS_State.value == "")
               {
                 alert("Please enter state");
                 document.frmStudentInfo.txtS_State.select();
                 return false;
               }
               else if(document.frmStudentInfo.txtS_Zip.value == "")
               {
                 alert("Please enter zip code");
                 document.frmStudentInfo.txtS_Zip.select();
                 return false;
               }
               else if(document.frmStudentInfo.txtS_Phone.value == "")
               {
                 alert("Please enter phone");
                 document.frmStudentInfo.txtS_Phone.select();
                 return false;
               }
               else if(isNaN(DOB) == true)
               {
                 alert("Please enter valid date in the format dd/mm/yy");
                 document.frmStudentInfo.txtS_Dob.select();
                 return false;
               }
               else if(lstInx == -1)
		       {
		         alert("Please select Advisor");
		         document.frmStudentInfo.lstF_ID.selectedIndex == 0;
		         return false;
		       }
              else if(radChecked == false)
		       {
		        alert("Please select class");
		        return false;
		       }
		      else
		      {
		        if(document.frmStudentInfo.chkResident.checked == true)
		          {
		           checkedBox = "YES";
		          }
                alert(FName +  " " + LName + "\n" +
					 Address + "\n" +
					 City + " " + State + " " + Zip + "\n" +
					 "Phone" +  " " + Phone + "\n" +
					 "Class" + " " +  radValue + "\n" +
					 "WI Resident" + " " + checkedBox + "\n" +
					 "Advisor" + " " + document.frmStudentInfo.lstF_ID.options[lstInx].text);
			 }	 
		  }
		//-->
		</script>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,732
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 323
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: ALERT and JAVA Script

  #2  
Mar 22nd, 2008
Develop using Firefox. You can use a nifty feature of Firefox called the Error Console which shows you all the Javascript errors on your page (if you have any).
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Join Date: Nov 2007
Posts: 86
Reputation: sagedavis is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
sagedavis sagedavis is offline Offline
Junior Poster in Training

Re: ALERT and JAVA Script

  #3  
Mar 22nd, 2008
I don't know how I found this but I did.
 alert("Please select Advisor");
		         document.frmStudentInfo.lstF_ID.selectedIndex == 0;
		         return false;
		       }
there is no "if" or "elsif" related to this line of code
Sage
Reply With Quote  
Join Date: Mar 2008
Posts: 169
Reputation: Traicey is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 16
Traicey's Avatar
Traicey Traicey is offline Offline
Junior Poster

Re: ALERT and JAVA Script

  #4  
Mar 25th, 2008
Thanx a lot guyz really appreciate it
My project is just perfect

Thanx once again
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:28 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC