Page 1 of 1

Cannot map GET error

Posted: Wed Jul 14, 2010 10:35 am
by garry99
I am scratching my head for an issue which has turned into a nightmare for me now.
The issue is I have a form in which an action is performed which direct it to some other php file save the data and presents the acknowledgment page. All this works fine if I don't use the validation call onclick.
But If I use onclick event in on submit button it gives me an error 403.
When I go to see the apache error log it show this to me.

apache error log

Code: Select all

[Wed Jul 14 13:52:54 2010] [error] [client ::1] (OS 87)The parameter is incorrect.  : Cannot map GET /gips/modules/Students/includes/GeneralInfoSave.php&start_date=0000-00-00&start_date_dp=1&start_date_year_start=1970&start_date_year_end=2015&start_date_mon=&start_date_da1=1970-01-01&start_date_da2=2015-12-31&start_date_sna=1&start_date_aut=&start_date_frm=&start_date_tar=&start_date_inp=&start_date_fmt=Y%20F%20j&school_name=&programe_name=&campus=&session=&SB=&REG_NO=&NAME_TITLE=&first_name=sada&middle_name=&last_name=aff&MARITAL_STATUS=&SEX=&BIRTH_DATE=0000-00-00&BIRTH_DATE_dp=1&BIRTH_DATE_year_start=1970&BIRTH_DATE_year_end=2015&BIRTH_DATE_mon=&BIRTH_DATE_da1=1970-01-01&BIRTH_DATE_da2=2015-12-31&BIRTH_DATE_sna=1&BIRTH_DATE_aut=&BIRTH_DATE_frm=&BIRTH_DATE_tar=&BIRTH_DATE_inp=&BIRTH_DATE_fmt=Y%20F%20j&PLACE_BIRTH=&CITIZENSHIP_PLACE=&PASSPORT_NO=&PHYSICAL_ADDRESS=&PHONE_WORK=&PHONE_RES=&PHONE_CELL=&POSTAL_ADDRESS=&PERMANENT_POSTAL_ADDRESS=&JC=&GCE=&CAMBRIDGE=&POST_QUALIFICATIONS=&WORK_EXPERIENCE=&PRESENT_EMPLOYER=&EMPLOYER_ADDRESS=&EMPLOYER_TELEPHONE=&SPONSORSHIP=&SPONSOR_NAME=&SPONSOR_DESIGNATION=&FEES_PAYABLE=&DATE1=0000-00-00&DATE1_dp=1&DATE1_year_start=1950&DATE1_year_end=2015&DATE1_mon=&DATE1_da1=1950-01-01&DATE1_da2=2015-12-31&DATE1_sna=1&DATE1_aut=&DATE1_frm=&DATE1_tar=&DATE1_inp=&DATE1_fmt=Y%20F%20j&WITNESS1=&WITNESS2=&WITNESS1_PHONE=&WITNESS2_PHONE=&WITNESS1_ADDRESS=&WITNESS2_ADDRESS=&process=Save&ajax=true HTTP/1.1 to file, referer: http://localhost/gips/Modules.php?modname=misc/Portal.php&failed_log



form page

Code: Select all

<?php
include_once('modules/Students/includes/functions.php');

mysql_connect('localhost','root','');
mysql_select_db(gips);
@extract($_REQUEST);
$school=UserSyear();



$SqlS = mysql_query("select max(student_id) as maxsid from students");
$resultS = mysql_fetch_array($SqlS);

$seq=$resultS['maxsid'];
if($seq=='')
{
   $sid=1;
}
else
{
   $sid=$seq+1;
}
$_SESSION['SID']=$sid;
//print_r($_SESSION['SID']);
$_SESSION['SPONSORSHIP']=$_REQUEST['SPONSORSHIP'];
$_SESSION['SPONSORSHIP']=$spsr;
print_r($spsr);
		
PopTable('header','New Student');
		
require_once('calendar/classes/tc_calendar.php');

	

?>



<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Add a student</title>
<script src="http://localhost/gips/modules/Billing/ajax.js" type="text/javascript"></script>


  

<script>
var isNav, isIE;
//Browser checking
if(parseInt(navigator.appVersion)>=4)
{
if(navigator.appName=="Netscape") {
  isNav=true;
}
else {
  isIE=true;
  }
}

 
</script>


</head>

<body>

<!--<TABLE BORDER="0" width="70%" bgcolor="#EAEAEA">
<tr>
<td>-->



<form  action="http://localhost/gips/modules/Students/includes/GeneralInfoSave.php" method="post"  name="msgform">

<TABLE BORDER="0">

<TR>
<TD width="50%"><img  border="0" align="right" src="http://localhost/gips/assets/gips1.png" width="820"></img></TD>
</TR>

</TABLE>
<table border="0" width="100%" align="center" >
<tr>
<td colspan="100%">
<strong>STUDENT ENROLLMENT DETAILS</strong><br />
<br />
</td>
</tr>

<tr>
<td width="12%" align="left">
DATE:

<td width="3%">
<td width="32%">
<?php
$myCalendar = new tc_calendar("start_date", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1970, 2015);
$myCalendar->dateAllow('1970-01-01', '2015-12-31');
$myCalendar->setDateFormat('Y F j');
$myCalendar->writeScript();
?></td>


<td width="23%" align="right"><div align="left">&nbsp;School:</div></td>
<td width="30%">
 <select id="school_name" name="school_name" class="txt">
							<option value="">Select School</option>
							<?php 
								$SqlQuery = mysql_query("select id,title from schools");
								
								while($result = mysql_fetch_array($SqlQuery))
								{
							?>
							<option value="<?php echo $result[id];?>"
							<?php if($programe_name==$result[id]){?> selected="selected"<?php }?>><?php echo $result['title'];?></option>

							<?php }?>
	  </select>

</td>
</tr>
</table>


<hr>




<TABLE BORDER="0" width="100%" >
<TR>

<TD  width="15%" align="right"><div align="left">Program Name:</div></TD>
<td width="32%" align="left">
    <select id="programe_name" name="programe_name" class="txt" onChange="javascript:selectlevelforinstallmentsforedit2(this.value)">
							<option value="">Select Program</option>
							<?php 
								$SqlQuery = mysql_query("select distinct short_name from school_gradelevels");
								
								while($result = mysql_fetch_array($SqlQuery))
								{
							?>
							<option value="<?php echo $result[short_name];?>"
							<?php if($programe_name==$result[short_name]){?> selected="selected"<?php }?>><?php echo $result['short_name'];?></option>
							<?php }?>

	  </select>
	  </td>
	  
	<td width="53%"  id="subcatid247">Program Level</td>
</tr> 
	  
	  
	  


		
</TR>
</TABLE>
		
<TABLE BORDER="0" width="100%" >
<tr>
<TD  width="15%" align="right"><div align="left">Campus of Study:</div></TD>
<TD  width="85%">
                        <select name="campus" class="txt" >

							<option value="">Select Campus</option>
							
							<option value="GABORONE">GABORONE</option>
							<option value="LOBATSE">LOBATSE</option>
							<option value="FRANCISTOWN">FRANCISTOWN</option>
						</select>
</TD>		
</TR>
</TABLE>

		
<hr>


<TABLE BORDER="0" width="100%" >
<tr>
<TD width="15%" align="right"  ><div align="left">Session: </div></TD>
<TD width="32%"> <select name="session" class="txt">
							<option value="">Select Session</option>
							
							<option value="DAY">DAY</option>
							<option value="EVENING">EVENING</option>

							
								  </select>
								  
 </TD>		

<TD width="23%" align="right"><div align="left">Have You Studied Before With Us ?</div></TD>
<TD width="30%">    <select name="SB" class="txt">
							<option value="">Select Yes/No</option>
							
							<option value="YES">YES</option>
							<option value="NO">NO</option>

							
						 </select>
	  </TD>		

</TR>
</TABLE>

<TABLE BORDER="0" width="100%" >
<tr>
<td width="15%" align="right" ><div align="left">GIPS Registration No:</div></td>		
<TD width="30%"><input name="REG_NO" type="text" id="REG_NO"></TD>
<TD width="25%"></TD>
<TD width="30%"></TD>			
</TR></TABLE>


<TABLE BORDER="0" width="100%" >
<TR>
<TD width="8%" align="left">
<select name="NAME_TITLE" class="txt" onChange="">
							<option value="">Title</option>
							
							<option value="Mr">Mr</option>
							<option value="Mrs">Mrs</option>
							<option value="Miss">Miss</option>
		</select>

</TD>
<TD width="24%">First Name:
  <input name="first_name" type="text" id="first_name"  > 
  </TD>
<TD width="25%">Middle Name:
  <input name="middle_name" type="text" id="middle_name"> 
  </TD>
<TD width="43%">Last Name:
  <input name="last_name" type="text" id="last_name"  onmousedown="trial(this.value)" > 
  </TD>
</TR>
</TABLE>

<TABLE BORDER="0" width="100%" >
<tr>
<td width="15%" align="right" ><div align="left">Marital Status:</div></td>

<TD width="32%">
<select name="MARITAL_STATUS" class="txt" onChange="">
							<option value="">Select Status</option>
							
							<option value="SINGLE">SINGLE</option>
							<option value="MARRIED">MARRIED</option>
							<option value="OTHER">OTHER</option>
		</select>

</TD>
<td width="23%" align="right" ><div align="left">Sex:</div></td>

<TD width="30%">
<select name="SEX" class="txt">
							<option value="">Select Sex</option>
							
							<option value="M">M</option>
							<option value="F">F</option>
							
		</select>

</TD>
</TR></TABLE>

<TABLE BORDER="0" width="100%" >
<tr>
<td width="15%" align="right">
  <div align="left">Date of Birth : 
  </div></TD>
<TD width="32%">


<?php
$myCalendar = new tc_calendar("BIRTH_DATE", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1970, 2015);
$myCalendar->dateAllow('1970-01-01', '2015-12-31');
$myCalendar->setDateFormat('Y F j');
$myCalendar->writeScript();
?></TD>

<td width="23%" align="right"><div align="left">Place Of Birth:: </div></td>

<TD width="30%"><input type="text" id="PLACE_BIRTH" name="PLACE_BIRTH" ></TD>
</tr></TABLE>




<TABLE BORDER="0" width="100%" >
<tr>
<td width="15%" align="right"><div align="left">Citizenship:</div></TD> 
<TD width="32%"><input type="text" id="CITIZENSHIP_PLACE" name="CITIZENSHIP_PLACE"></td>
<td width="23%" align="right"> <div align="left">Omang No./Passport No.:</div></td>
<td width="30%"><input type="text" id="PASSPORT_NO" name="PASSPORT_NO"></td>
</tr></TABLE>


<TABLE BORDER="0" width="100%" >
<tr>
<td width="15%" align="right"><div align="left">Physical Address:</div></TD>
<TD width="14%" ><TEXTAREA id="PHYSICAL_ADDRESS" name="PHYSICAL_ADDRESS" ></TEXTAREA></td>
<td width="41%" align="right"></td>
<td width="30%"></td>
</tr></TABLE>


<TABLE BORDER="0" width="100%">
<tr>
<td width="15%" align="right"><div align="left">Phone No.(Wrk):</div></TD> 

<TD width="21%"><input type="text"   id="PHONE_WORK" name="PHONE_WORK" value=""></td>
<td width="30%">(Res):
  <input type="text" id="PHONE_RES" name="PHONE_RES" value=""> </td>
<td width="34%">(Cell):
  <input type="text" id="PHONE_CELL" name="PHONE_CELL" value=""> </td>
</tr></TABLE>



<TABLE BORDER="0" width="100%" >
<tr>
<td width="15%" align="right"><div align="left">Postal Address: </div></TD> 
<TD width="32%"><TEXTAREA id="POSTAL_ADDRESS" name="POSTAL_ADDRESS"  value=""></TEXTAREA></td>

<td width="23%" align="right"><div align="left">Permanent Postal Address: </div></td>
<td width="30%"><TEXTAREA id="PERMANENT_POSTAL_ADDRESS" name="PERMANENT_POSTAL_ADDRESS"  value=""></TEXTAREA></td>
</tr></TABLE>

<hr>


<table>
<tr>
<td>
<B>QUALIFICATIONS</B>
</td></tr>
</table>

<TABLE BORDER="0" width="100%">
<tr>
<td width="13%" align="right"><div align="justify">School Certificates: </div></TD> 
<TD width="23%">JC:
  <input type="text"  id="JC" name="JC"  value=""> </td>
<td width="25%">GCE:
  <input type="text"  id="GCE" name="GCE"  value=""></td>
<td width="39%">CAMBRIDGE:
  <input type="text"  id="CAMBRIDGE" name="CAMBRIDGE"  value=""> </td>
</tr></TABLE>

<br/>

<TABLE BORDER="0" width="100%">

<tr>
<td width="15%" align="right"><div align="left">Post Qualifications : </div></TD>
<TD width="30%"><input type="text" size="38px" id="POST_QUALIFICATIONS" name="POST_QUALIFICATIONS" value=""></td>
<td width="25%" align="right"></td>
<td width="30%"></td>

</tr></TABLE>
<BR/>



<hr>


<TABLE BORDER="0" width="100%">
<tr>

<td width="15%" align="right"><div align="left">Work Exp (In Years):</div></TD>
<TD width="30%"><input type="text" size="38px" id="WORK_EXPERIENCE"  name="WORK_EXPERIENCE" value=""></td>
<td width="25%" align="right"></td>
<td width="30%"></td>
</tr></TABLE>

<BR/>

<B>PARTICUALRS OF PRESENT EMPLOYER:</B><BR/>

<TABLE BORDER="0" width="100%">
<tr>
<td width="15%" align="right"><div align="left">Employer/Company Name :</div></TD>
<TD width="30%"><input type="text" size="32px" id="PRESENT_EMPLOYER" name="PRESENT_EMPLOYER" value=""></td>

<td width="25%" ></td>
<td width="30%"></td>

</tr></TABLE>

<BR/>



<table BORDER="0" width="100%">
<tr>
<td width="15%" align="right"><div align="left">Addrress:</div></TD>
<td width="30%"><TEXTAREA id="EMPLOYER_ADDRESS" name="EMPLOYER_ADDRESS"  value=""></TEXTAREA></td>
<td width="25%" align="right"><div align="left">Telephone Number :</div></td>

<td width="30%"><input type="text" size="20px" id="EMPLOYER_TELEPHONE" name="EMPLOYER_TELEPHONE" value=""></td>
</tr></table>
<hr>

<table BORDER="0" width="100%">
<tr><td >
<B>SPONSORSHIP</B>
</td>
</tr>
<tr>
<td width="38%">Sponsor Level 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <select id="SPONSORSHIP" name="SPONSORSHIP" class="txt" onChange="javascript:selectBOSTANA(this.value)">
							<option value="" selected="selected">Select Sponsor</option>

							<?php 
								$SqlQuery = mysql_query("select distinct TITLE from SPONSHORSHIP");
								
								while($result = mysql_fetch_array($SqlQuery))
								{
							?>
							<option value="<?php echo $result[TITLE];?>"
							<?php if($programe_name==$result[TITLE]){?><?php }?>><?php echo $result['TITLE'];?></option>
							<?php }?>
	  </select>
	
</td>
<td id="subcatid203" width="62%"></td>
</tr></table>
<table BORDER="0" width="100%">
<tr><td width=78%>
<br/>
(Approval/declaration by department responsible for manpower or relatives) please select the applicable or pleass provide your Approval Letter/GPO, or any other means to prove.<br/>I/We, the undersigned hereby approve and declare that I/We have read and understood your fee and other regualtions mentioned above and below and I/We shall be responsible for payment for the other course being applied for by: 

</td></tr>
</table>


<table>
<tr>
<td>
<B>Sponsorship Grant</B>
</td></tr></table>
<TABLE><TR><TD>Name :<input type="text" size="20px" id="SPONSOR_NAME" name="SPONSOR_NAME"  value="">&nbsp;&nbsp;&nbsp;&nbsp;
 Designation:<input type="text" size="20px" id="SPONSOR_DESIGNATION" name="SPONSOR_DESIGNATION" value=""></TD>
</TR></TABLE><BR><BR/>

<table><TR><TD>SIGNATURE:................................</TD></TR></table>


<hr>


<table>
<tr><td><B>GENERAL RULES & REFUND POLICY</B></TD></TR>
<tr><td>Document required for the admission of new students</td></tr>
</table>

<table>

<tr><td>1. Certified Omang Copy/Passport Copy</TD></TR>
<tr><td>2. Certified copy of Educational Qualifications</TD></TR>
<tr><td>3. CProff of Registration- if the student is registered with any external body</TD></TR>
<tr><td>4. Copy of any other GIPS receipt or GIPS I.D. copy -if the student is an old student of GIPS</TD></TR>
</table>

<hr>

<table>
<tr><td><B>PARAGRAPH 1.</B></TD></TR>
<tr><td>1. Administrativr Charges usch as admission fees are non-refundable.</TD></TR>

<tr><td>2. 50% fee is refundable to the student only if the refund application is received by the accounts department atleast 15 days before the scheduled starting date of the first batch to which the student is admitted. No refunds will be given after that date.</TD></TR>
<tr><td>3. If the Institute cancels the course or postpones beyond one month- 100% fee will be rfunded, if payment was made less than 15 days before starting date then no refund will be made.</TD></TR>
</table>


<table>
<tr><td><B>PARAGRAPH 2.</B></TD></TR>
<tr><td>The total course fees can be paid in advance. The Institute reserves the right to decide on the mthod of payment to be adopted.</TD></TR></table>

<table>
<tr><td><B>PARAGRAPH 3.</B></TD></TR>
<tr><td>A student who enrols for a course shall be obliged to cpmplte his.her studies in that course. Withdrwal from the course shall not render unpayable, the outstanding  balance for that course a student is enrolled for. A person or persons who enrol(s) for a course sgall be bound to pay all the course fees regardless of whether they as an after thought or otherwise decide to withdraw from the course</TD></TR>

</table>


<table>
<tr><td><B>PARAGRAPH 4.</B></TD></TR>
<tr><td>The Gaborone Institute of Professional Studies reserves the right to render a student who withdraws froma  course, immune to the implications of PARAGRAPH2 above.</TD></TR>
</table>


<table>
<tr><td><B>PARAGRAPH 5.</B></TD></TR>
<tr><td>The total fee for the course to be applied payable is (P): <input type="text" size="20px" id="FEES_PAYABLE"  name="FEES_PAYABLE" value=""></TD></TR>
</table>

<table><tr><td><B>PARAGRAPH 6.</B></TD></TR>
<tr><td>Cheque will be accepted if amount exceeds P2000. If any cheque bounces a penalty of P300 will be charged for each cheque and the total amount should be paid immediately. The students are requested to keep the original receipts until they collect the certificate. If the installments are not paid the institute has the right to transfer the fees paid for the exams and the registrations. Fees for external bodies Admission fee, Registrations fee and examination fee will be paid from 5th March-5th August apart from the course fee. </TD></TR>
</table>

<table><tr><td>I..............................................................hereby declare that I have read and understood the contents of PARAGRAPH 1-6 and agree that the legal action can be taken against me on the facts or implications of all or any of the paragraphs above.</TD></TR>
<tr><td> I also agree to pay deposit and registration fees of P..................... and thereafter monthly installments of P...............<br> per month which I will pay consecutively over a period .............. months.</td></tr>
</table><BR/>


<table><tr>
<td> Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php
$myCalendar = new tc_calendar("DATE1", true, false);
$myCalendar->setIcon("calendar/images/iconCalendar.gif");
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1950, 2015);
$myCalendar->dateAllow('1950-01-01', '2015-12-31');
$myCalendar->setDateFormat('Y F j');
$myCalendar->writeScript();
?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Signature...................&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Witnessed.................</TD>
</tr>
</table>
<BR/>

<table width=100%>
<tr>
<td> Referees(Two referees are needed)</td></tr>
<tr><td> NAME:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

    <input type="text" size="20px"  name="WITNESS1" value="" /></td>
<TD>NAME:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="20px"  name="WITNESS2" value=""></td></tr>

<tr><td>PHONE:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="20px"  name="WITNESS1_PHONE" value=""></td><TD> PHONE:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="20px"  name="WITNESS2_PHONE" value=""></td></tr>

<tr><td> ADDRESS:<input type="text" size="20px"  name="WITNESS1_ADDRESS" value=""></td><TD>ADDRESS:<input type="text" size="20px"  name="WITNESS2_ADDRESS" value=""></td></tr>
</table>





<table border="0" width="100%" align="center" >

<tr>
		
<td colspan="100%" align="center" ><input class="btn_medium" type="submit"  id="Submit" name="process" value="Save" size="30" onClick="checkform()" >
</td>
</tr>	
</table>	
	
</form>
</body>
</html>
please help.

Thanks & Regards
Garry99

Re: Cannot map GET error

Posted: Wed Jul 14, 2010 12:07 pm
by JakeJ
You should probably be using POST instead of GET. With the validation, you could be pushing it over the character limit.

Re: Cannot map GET error

Posted: Thu Jul 15, 2010 12:54 am
by garry99
Hi,
I am actually using post, i don't know y it shows get in the error.
Here's my form tag code:
<form action="http://localhost/gips/modules/Students/ ... foSave.php" method="post" name="msgform">
then the submit button code:
<input class="btn_medium" type="submit" id="Submit" name="process" value="Save" size="30" onClick="checkform()" >
here's the checkform() code which is being called on submit:
function checkform()
{

var frmvalidator = new Validator("msgform");

frmvalidator.addValidation("first_name","req","Please enter the first name of the student");
frmvalidator.addValidation("last_name","req","Please enter the the last name of the student");
}

Code: Select all

validator file which is being used


function Validator(frmname)
{
  this.formobj=document.forms[frmname];
	if(!this.formobj)
	{
	  alert("BUG: couldnot get Form object "+frmname);
		return;
	}
	if(this.formobj.onsubmit)
	{
	 this.formobj.old_onsubmit = this.formobj.onsubmit;
	 this.formobj.onsubmit=null;
	}
	else
	{
	 this.formobj.old_onsubmit = null;
	}
	this.formobj.onsubmit=form_submit_handler;
	this.addValidation = add_validation;
	this.setAddnlValidationFunction=set_addnl_vfunction;
	this.clearAllValidations = clear_all_validations;
}
function set_addnl_vfunction(functionname)
{
  this.formobj.addnlvalidation = functionname;
}
function clear_all_validations()
{
	for(var itr=0;itr < this.formobj.elements.length;itr++)
	{
		this.formobj.elements[itr].validationset = null;
	}
}
function form_submit_handler()
{
	for(var itr=0;itr < this.elements.length;itr++)
	{
		if(this.elements[itr].validationset &&
	   !this.elements[itr].validationset.validate())
		{
		  return false;
		}
	}
	if(this.addnlvalidation)
	{
	  str =" var ret = "+this.addnlvalidation+"()";
	  eval(str);
    if(!ret) return ret;
	}
	
if(ajaxform(this, this.action) =='failed')
	return true;
	
	return false;
}
function add_validation(itemname,descriptor,errstr)
{
  if(!this.formobj)
	{
	  alert("BUG: the form object is not set properly");
		return;
	}
	var itemobj = this.formobj[itemname];
  if(!itemobj)
	{
		return;
	}
	if(!itemobj.validationset)
	{
	  itemobj.validationset = new ValidationSet(itemobj);
	}
  itemobj.validationset.add(descriptor,errstr);
}
function ValidationDesc(inputitem,desc,error)
{
  this.desc=desc;
	this.error=error;
	this.itemobj = inputitem;
	this.validate=vdesc_validate;
}
function vdesc_validate()
{
 if(!V2validateData(this.desc,this.itemobj,this.error))
 {
    this.itemobj.focus();
		return false;
 }
 return true;
}
function ValidationSet(inputitem)
{
    this.vSet=new Array();
	this.add= add_validationdesc;
	this.validate= vset_validate;
	this.itemobj = inputitem;
}
function add_validationdesc(desc,error)
{
  this.vSet[this.vSet.length]= 
	  new ValidationDesc(this.itemobj,desc,error);
}
function vset_validate()
{
   for(var itr=0;itr<this.vSet.length;itr++)
	 {
	   if(!this.vSet[itr].validate())
		 {
		   return false;
		 }
	 }
	 return true;
}
function validateEmailv2(email)
{
    if(email.length <= 0)
	{
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}





function V2validateData(strValidateStr,objValue,strError) 
{ 
    var epos = strValidateStr.search("="); 
    var  command  = ""; 
    var  cmdvalue = ""; 
    if(epos >= 0) 
    { 
     command  = strValidateStr.substring(0,epos); 
     cmdvalue = strValidateStr.substr(epos+1); 
    } 
    else 
    { 
     command = strValidateStr; 
    } 
	strError=escape(strError);
	strError=unescape(strError);
    switch(command) 
    { 
        case "req": 
        case "required": 
         { 
           if(eval(objValue.value.length) == 0) 
           { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name + " : Required Field"; 
              }
			  document.getElementById('divErr').innerHTML="<b><font color=red>"+strError+"</font></b>";
              return false; 
           }
           break;             
         }
        case "maxlength": 
        case "maxlen": 
          { 
             if(eval(objValue.value.length) >  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : "+cmdvalue+" characters maximum "; 
               }
			   document.getElementById('divErr').innerHTML="<b><font color=red>"+ strError + "\n[Current length = " + objValue.value.length + " ]" +"</font></b>";
               return false; 
             }
             break; 
          }
        case "minlength": 
        case "minlen": 
           { 
             if(eval(objValue.value.length) <  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : " + cmdvalue + " characters minimum  "; 
               }      
			   document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n[Current length = " + objValue.value.length + " ]"+"</font></b>";
               return false;                 
             }
             break; 
            }
        case "alnum": 
        case "alphanumeric": 
           { 
              var charpos = objValue.value.search("[^A-Za-z0-9. ]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
               if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alpha-numeric characters allowed "; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
              break; 
           }
		case "grade_title": 
           { 
              var charpos = objValue.value.search("[^A-Za-z0-9.+- ]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
               if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alpha-numeric characters allowed "; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
              break; 
           }
        case "num": 
        case "numeric": 
           { 
              var charpos = objValue.value.search("[^0-9]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only digits allowed "; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
              break;               
           }
        case "dec": 
        case "decimal": 
           { 
              var charpos = objValue.value.search("[^0-9.]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only digits allowed "; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
              break;               
           }
        case "ph":
        case "phone":
           { 
              var charpos = objValue.value.search("[^0-9-\(\)\, ]");
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only valid phone number allowed "; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
              break;               
           }
        case "alphabetic": 
        case "alpha": 
           { 
			 var charpos = objValue.value.search("[^A-Za-z ]");
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alphabetic characters allowed "; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
              break; 
           }
        case "alphaspchar": 
           { 
			 var charpos = objValue.value.search("[^A-Za-z\-\' ]");
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": Only alphabetic characters allowed "; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
              break; 
           }
		case "alnumhyphen":
			{
              var charpos = objValue.value.search("[^A-Za-z0-9\-_]"); 
              if(objValue.value.length > 0 &&  charpos >= 0) 
              { 
                  if(!strError || strError.length ==0) 
                { 
                  strError = objValue.name+": characters allowed are A-Z,a-z,0-9,- and _"; 
                }
				document.getElementById('divErr').innerHTML="<b><font color=red>"+strError + "\n [Error character position " + eval(charpos+1)+"]"+"</font></b>";
                return false; 
              }
			break;
			}
        case "email": 
          { 
               if(!validateEmailv2(objValue.value)) 
               { 
                 if(!strError || strError.length ==0) 
                 { 
                    strError = "Enter a valid Email address "; 
                 }
				 document.getElementById('divErr').innerHTML="<b><font color=red>"+strError+"</font></b>";
                 return false; 
               }
           break; 
          }
		  
		
		case "url": 
          { 
               if(!validateurl(objValue.value)) 
               { 
                 if(!strError || strError.length ==0) 
                 { 
                    strError = "Enter a valid URL "; 
                 }
				 document.getElementById('divErr').innerHTML="<b><font color=red>"+strError+"</font></b>";
                 return false; 
               }
           break; 
          }
		  
		
		  
        case "lt": 
        case "lessthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
			  document.getElementById('divErr').innerHTML="<b><font color=red>"+objValue.name+": Should be a number "+"</font></b>";
              return false; 
            }
            if(eval(objValue.value) >=  eval(cmdvalue)) 
            { 
              if(!strError || strError.length ==0) 
              { 
                strError = objValue.name + " : value should be less than "+ cmdvalue; 
              }
			  document.getElementById('divErr').innerHTML="<b><font color=red>"+strError+"</font></b>";
              return false;                 
             }
            break; 
         }
        case "gt": 
        case "greaterthan": 
         { 
            if(isNaN(objValue.value)) 
            { 
			  document.getElementById('divErr').innerHTML="<b><font color=red>"+objValue.name+": Should be a number "+"</font></b>";
              return false; 
            }
             if(eval(objValue.value) <=  eval(cmdvalue)) 
             { 
               if(!strError || strError.length ==0) 
               { 
                 strError = objValue.name + " : value should be greater than "+ cmdvalue; 
               }
			   document.getElementById('divErr').innerHTML="<b><font color=red>"+strError+"</font></b>";
               return false;                 
             }
            break; 
         }
        case "regexp": 
         { 
		 	if(objValue.value.length > 0)
			{
	            if(!objValue.value.match(cmdvalue)) 
	            { 
	              if(!strError || strError.length ==0) 
	              { 
	                strError = objValue.name+": Invalid characters found "; 
	              }
				  document.getElementById('divErr').innerHTML="<b><font color=red>"+strError+"</font></b>";
	              return false;                   
	            }
			}
           break; 
         }
        case "dontselect": 
         { 
            if(objValue.selectedIndex == null) 
            { 
			  document.getElementById('divErr').innerHTML="<b><font color=red>"+"BUG: dontselect command for non-select Item"+"</font></b>";
              return false; 
            } 
            if(objValue.selectedIndex == eval(cmdvalue)) 
            { 
             if(!strError || strError.length ==0) 
              { 
              strError = objValue.name+": Please Select one option "; 
              }
			  document.getElementById('divErr').innerHTML="<b><font color=red>"+strError+"</font></b>";
              return false;                                   
             } 
             break; 
         }
    }
    return true; 
}






function doDateCheck(from, to) {

if (Date.parse(from) >= Date.parse(to)) {
document.getElementById('divErr').innerHTML="<b><font color=red>"+"End date must occur after the Start date."+"</font></b>";
return false;
}
else
{
return true;
}
}



function isDate(fm,fd,fy)
{
var strdate;
strdate = Date.parse(fm.value + " " + fd.value +" " + ChangeYear(fy.value));

if(isNaN(strdate))
{

return false;
}
else
{
return true;
}
}



function ChangeYear(year)
{
var strYear;
strYear = year;
 
if (strYear.length == 2) {
if (00 <= strYear && strYear <25)
{
strYear = '20' + strYear;
}
else
{
strYear = '19' + strYear;
}
} 

return strYear;

}



function CheckDate(fm, fd, fy, tm, td, ty)
{
var from;
var to;


from = fm.value + " " + fd.value +" " + ChangeYear(fy.value);
to = tm.value + " " + td.value +" " + ChangeYear(ty.value);
if (false==doDateCheck(from, to))
	return false;
else
	return true;

}

/* *************************************************** Check Time Start ****************************************************** */

function CheckTime(fd, fh, fm, fp, td, th, tm, tp)
{
var from;
var to;
var p1;
var p2;

if(fp.value=='AM')
	p1=1;
if(fp.value=='PM')
	p1=2;
if(tp.value=='AM')
	p2=1;
if(tp.value=='PM')
	p2=2;

if(parseFloat(fd.value) == parseFloat(td.value))
{
	if(p1 > p2)
	{
		document.getElementById('divErr').innerHTML="<b><font color=red>"+"Starting time must occur after the ending date."+"</font></b>";
		return false;
	}

	if(p1 == p2)
	{
		if((parseFloat(fh.value) > parseFloat(th.value)))
		{
			document.getElementById('divErr').innerHTML="<b><font color=red>"+"Starting time must occur after the ending date."+"</font></b>";
			return false;
		}
		
		if(parseFloat(fh.value) == parseFloat(th.value))
		{
			if(parseFloat(fm.value) > parseFloat(tm.value))
			{
				document.getElementById('divErr').innerHTML="<b><font color=red>"+"Starting time must occur after the ending date."+"</font></b>";
				return false;
			}
		}
	}
	
}
return true;
}
/* **************************************************** Check Time End ****************************************************** */

/******************************************  For SchoolSetup Marking Periods Start  ********************************************/

function doDateCheckMar(from, to) {

if (Date.parse(from) > Date.parse(to)) {
document.getElementById('divErr').innerHTML="<b><font color=red>"+"Grade Posting Begins date can not be occur before the Begins date."+"</font></b>";
return false;
}
else
{
return true;
}
}


function CheckDateMar(fm, fd, fy, tm, td, ty)
{
var from;
var to;


from = fm.value + " " + fd.value +" " + ChangeYear(fy.value);
to = tm.value + " " + td.value +" " + ChangeYear(ty.value);
if (false==doDateCheckMar(from, to))
	return false;
else
	return true;

}



function doDateCheckMarEnd(from, to) {

if (Date.parse(from) > Date.parse(to)) {
document.getElementById('divErr').innerHTML="<b><font color=red>"+"Grade Posting End date can not be occur after the End date."+"</font></b>";
return false;
}
else
{
return true;
}
}


function CheckDateMarEnd(fm, fd, fy, tm, td, ty)
{
var from;
var to;


from = fm.value + " " + fd.value +" " + ChangeYear(fy.value);
to = tm.value + " " + td.value +" " + ChangeYear(ty.value);
if (false==doDateCheckMarEnd(from, to))
	return false;
else
	return true;

}

function CheckBirthDate(fm,fd,fy) {
var strdate;
strdate = Date.parse(fm.value + " " + fd.value +" " + ChangeYear(fy.value));
var today = new Date();

if(isNaN(strdate))
{
document.getElementById('divErr').innerHTML="<b><font color=red>"+"Enter a valid Date of Birth"+"</font></b>";
return false;
}
else
{
if (strdate > Date.parse(today)) 
{
document.getElementById('divErr').innerHTML="<b><font color=red>"+"Invalid Birth Date"+"</font></b>";
return false;
}
else
return true;
}

}

function numberOnly(event) {
	var keynum = event.keyCode || e.which;
	if (((keynum > 47) && (keynum < 58)) || (keynum == 8) || (keynum == 9) || (keynum == 46) || ((keynum > 95) && (keynum < 106)) || ((keynum > 36) && (keynum < 41)))
	return true;
	else
	return false;
}

function validate_chk(chk_box)
{
  var boolIsChecked = chk_box.checked;
  
  if (boolIsChecked == false)
  {
  	return false;
  }
  else
  {
  	return true;
  }
  
}







Please help I am in trouble. I will be really thankful.


Kind Regards
Garry99

Re: Cannot map GET error

Posted: Thu Jul 15, 2010 1:22 am
by JakeJ
Is it possible that the validator is submitting the code to another page and returning values. I noticed the ajax stuff in there. Maybe the validator itself is using GET in some way.

Re: Cannot map GET error

Posted: Thu Jul 15, 2010 4:17 am
by garry99
Hello ,
The problem arise only when i use the validaion stuff.
Otherwise it is okay, I don't know where the problem is, but it is getting frustrated now. I have attached the validator file in the previous post, also find the attached ajax.js code if you could go through it and help me, I will be highly thankful to u.'
'
function GetXmlHttpObject()

{

if (window.XMLHttpRequest)

{

// code for IE7+, Firefox, Chrome, Opera, Safari

return new XMLHttpRequest();

}

if (window.ActiveXObject)

{

// code for IE6, IE5

return new ActiveXObject("Microsoft.XMLHTTP");

}

return null;

}

function xmlhttpPost(strURL, strSubmit, strResultFunc) {

var xmlHttpReq = false;
alert('Hai');
xmlHttpReq=GetXmlHttpObject();

if (xmlHttpReq==null)

{

alert ("Browser does not support HTTP Request");

return;

}



// Mozilla/Safari

// if (window.XMLHttpRequest) {

// xmlHttpReq = new XMLHttpRequest();

// xmlHttpReq.overrideMimeType('text/xml');

// }

// IE

// else if (window.ActiveXObject) {

// xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

// }

// if (window.XMLHttpRequest)

// {

// code for IE7+, Firefox, Chrome, Opera, Safari

// xmlhttp=new XMLHttpRequest();

// }





xmlHttpReq.open('POST', strURL, true);

xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

xmlHttpReq.onreadystatechange = function() {

if (xmlHttpReq.readyState == 4) {

strResponse = xmlHttpReq.responseText;

switch (xmlHttpReq.status) {

// Page-not-found error

case 404:

alert('Error: Not Found. The requested URL ' +

strURL + ' could not be found.');

break;

// Display results in a full window for server-side errors

case 500:

handleErrFullPage(strResponse);

break;

default:

// Call JS alert for custom error or debug messages

if (strResponse.indexOf('Error:') > -1 ||

strResponse.indexOf('Debug:') > -1) {

alert(strResponse);

}

// Call the desired result function

else {

eval(strResultFunc + '(strResponse);');

}

break;

}

}

}

xmlHttpReq.send(strSubmit);

}



function handleErrFullPage(strIn) {



var errorWin;



// Create new window and display error

try {

errorWin = window.open('', 'errorWin');

errorWin.document.body.innerHTML = strIn;

}

// If pop-up gets blocked, inform user

catch(e) {

alert('An error occurred, but the error message cannot be' +

' displayed because of your browser\'s pop-up blocker.\n' +

'Please allow pop-ups from this Web site.');

}

}

Kind Regards
Garry99

Re: Cannot map GET error

Posted: Thu Jul 15, 2010 11:10 am
by JakeJ
As I said before, I'm not an ajax expert but it looks like the ajax code is using post. Go download Fiddler and watch for the GET code to pop up and perhaps you can figure out where it's coming from.

Other than that I'm out of advice except to start telling you to start tearing apart your validator piece by piece until you find out which part is causing you the trouble.