onchange()

for a particular text box i am calling a function onchage() by default the text box has the value"0" when number is entered say "2" it calls the function and does few calculations... but if i enter a number say "5 or 6 or 7 or 2" for some numbers after the calculation i have given a provision to set it back to "0" like this document.groupbooking.OcnQuad.value=0;but after that if i enter the same number say "5" it doesnot call the function... y it happens so...????hope my question is clear
LVL 21
surajgupthaAsked:
Who is Participating?
 
sajuksCommented:
ur NAN error is  already there
for that instead of using parseint try this
var OcnDbS = 1*(input)-(((document.groupbooking.OcnSingle.value)*1)+
(1*(document.groupbooking.OcnTriple.value))+(1*(document.groupbooking.OcnQuad.value)));

ie 1*(document.fieldname.value) // do this for all ur parseint

that shoulf take care of ur NAN problem

then declare a variable "var thisElement=null" at the beginning of ur script

<SCRIPT LANGUAGE="JavaScript">
  <!--
     var thisElement=null;  //<< not this
function valid(thiss) {

finally
<input onfocus='thisElement=this;' name="OcnSingle" type="text" class="field"
value="0" size="8" maxlength="4" onblur='setTimeout("valid(thisElement)",1);'>
instead of
<input name="OcnSingle" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'>

heres something which i've put together
//
<SCRIPT LANGUAGE="JavaScript">
  <!--
  var thisElement=null;
function valid(thiss) {
if(thiss == document.groupbooking.OcnSingle){  
   var input=document.groupbooking.OceanView.value;
     var OcnDbS = 1*(input)-(((document.groupbooking.OcnSingle.value)*1)+(1*(document.groupbooking.OcnTriple.value))+(1*(document.groupbooking.OcnQuad.value)));
 if(OcnDbS<0){
  document.groupbooking.OcnSingle.value=0;//here i am setting to "0"
  }
   }
   }

  //-->
  </SCRIPT>  
<FORM METHOD=POST name = "groupbooking" ACTION="">
<INPUT TYPE="text" NAME="OceanView">
<td><input name="OcnSingle" type="text" class="field" value="0" size="8" maxlength="4" onfocus='thisElement=this;' onblur='setTimeout("valid(thisElement)",2);'></td>
  <INPUT TYPE="text" NAME="OcnTriple">
    <INPUT TYPE="text" NAME="OcnQuad">

</FORM>
0
 
hongjunCommented:
post your existing code
0
 
surajgupthaAuthor Commented:
ok i ll paste a part of it..

function valid(thiss) {

if(thiss == document.groupbooking.OcnSingle){  

    var input=document.groupbooking.OceanView.value;
   
     var OcnDbS = parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));

 if(OcnDbS<0){
 
  document.groupbooking.OcnSingle.value=0;//here i am setting to "0"
  document.groupbooking.OcnDouble.value=parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));
  }else{
  document.groupbooking.OcnDouble.value=OcnDbS;
  }
  var OcnTot=((parseInt(document.groupbooking.OcnDouble.value))+(parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)))
  if(input==OcnTot)
  {
  document.groupbooking.OceanView.value=input;
  }else{
  alert("the cabin numbers exceeds pls check")
  document.groupbooking.OcnSingle.focus();
  }
 
 if(!actualpassengers()){

      document.groupbooking.OcnDouble.focus();
      return false;
     }
     document.groupbooking.OcnDouble.value=OcnDbS;
    if(OcnDb<0){
     document.groupbooking.OcnSingle.focus();
     }
      document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
if(document.groupbooking.OceanView.value==0) {
document.groupbooking.OcnSingle.value=0;
document.groupbooking.OcnDouble.value=0;
document.groupbooking.OcnTriple.value=0;
document.groupbooking.OcnQuad.value=0;
}
   }
   }
  ////////////////////////////////////////////////////////
   
  <td><input name="OcnSingle" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>


0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
sajuksCommented:
i've seen that and i normally use  the onblur instead of onchange for that
0
 
surajgupthaAuthor Commented:
will i have to change anything else in my code if i am using onblur() instead of onclick()??????
0
 
surajgupthaAuthor Commented:
i checked that link... ok i ll use onblur and see how it works... but after reading those comments i have a doubt.. what is onKeyPress??? and how to use onblur()  and onfocus together???
0
 
sajuksCommented:
the onblur gets called every time even if u dont do any change, thats a drawback .onChange() event is more stable.
if u r using onblur its advisable to use it within a settimeout function so that  the event is finished executing .
in the above link the proposed soln by mplungjan would be a good workaround.
0
 
sajuksCommented:
the onkeypress event occurs when the user presses or holds down a key..(might not be ideal for ur case if u allow double or more digits entry).

0
 
sajuksCommented:
<script>
//credit to mplungjan
function myBlur(fld) {
  if(fld.value == "") fld.value = "Enter Name";
}
function myFocus(fld) {
  if (fld.value == "Enter Name" || fld.value == "Invalid Entry")  fld.value = "";
}

</script>
<input type = "text" size = "40" maxlength = "50" name = "name" value = "Enter Name"  onblur = "myBlur(this)" onfocus = "myFocus(this)">
<input type = "text">
0
 
surajgupthaAuthor Commented:
i am really sorry... when i used onblur... it gives NAN not a number error b4 even i could enter  the number....
0
 
sajuksCommented:
thats why i said to use the settimeout
0
 
surajgupthaAuthor Commented:
could u please explain how to... i am really lost... how do i set time out and where.. pls do tell me...
0
 
sajuksCommented:
" i am really sorry... when i used onblur... it gives NAN not a number error b4 even i could enter  the number.... "
where exactly r u getting this error, need to see the full page
<INPUT  onfocus='thisElement=this;' onblur='setTimeout("validate(thisElement)",1);'>
u cannot use "this" in the setTimeout because it is out of scope maybe thats ur problem
0
 
surajgupthaAuthor Commented:


<%@page import="java.util.Calendar"%>
<%@page import="java.util.GregorianCalendar"%>

<%
Calendar calendar = new GregorianCalendar();
int mont=calendar.get(Calendar.MONTH);
int year=calendar.get(Calendar.YEAR);
int day=calendar.get(Calendar.DATE);
int hour =calendar.get(Calendar.HOUR);            
int minute =calendar.get(Calendar.MINUTE);
int seconds = calendar.get(Calendar.SECOND);
int ampm = calendar.get(Calendar.AM_PM);
String strAirportCode = null;
String strAmpm1=null;

if (null != request.getParameterValues("airportSelected")) {

    String[] arrAirportCode = request.getParameterValues("airportSelected");
    StringBuffer sbAirportCode = new StringBuffer();
    for (int i=0;i<arrAirportCode.length;i++) {

        sbAirportCode.append(arrAirportCode[i]);
        sbAirportCode.append(",");
    }
    strAirportCode = sbAirportCode.toString();
    strAirportCode = strAirportCode.substring(0,strAirportCode.length()-1);
    System.out.println("the airport codes are"+strAirportCode);
}

if (ampm==0) {

    strAmpm1 = "AM";

} else {

    strAmpm1 = "PM";

}

int month = ((mont)+1);
String date1=month+"/"+day+"/"+year;
String time = hour+":"+minute+":"+seconds+" "+strAmpm1;
System.out.println("The month is"    +date1);
System.out.println("The time is"     +time);

%>

<html>
<head>
<script>
var check=true;

function valid(thiss) {
//alert("i am laya");
if (!valid_character(document.groupbooking.NoOfCabins,"0123456789")) {

    alert("Invalid Entry for NoOfCabins");
    document.groupbooking.NoOfCabins.value="";
    return false;

     }
     
if (!valid_character(document.groupbooking.Passengers,"0123456789")) {

    alert("Invalid Entry for given number of passengers");
    document.groupbooking.Passengers.value="";
    return false;

     }    
if (!valid_character(document.groupbooking.IntSingle,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.IntSingle.value=0;
    return false;

     }  
if (!valid_character(document.groupbooking.IntTriple,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.IntTriple.value=0;
    return false;

}  
if (!valid_character(document.groupbooking.IntQuad,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.IntQuad.value=0;
    return false;

}
if (!valid_character(document.groupbooking.OcnSingle,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.OcnSingle.value=0;
    return false;

}
if (!valid_character(document.groupbooking.OcnTriple,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.OcnTriple.value=0;
    return false;

}
if (!valid_character(document.groupbooking.OcnQuad,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.OcnQuad.value=0;
    return false;

}
if (!valid_character(document.groupbooking.BlySingle,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.BlySingle.value=0;
    return false;

}
if (!valid_character(document.groupbooking.BlyTriple,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.BlyTriple.value=0;
    return false;

}
if (!valid_character(document.groupbooking.BlyQuad,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.BlyQuad.value=0;
    return false;

}
if (!valid_character(document.groupbooking.SuitSingle,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.SuitSingle.value=0;
    return false;

}
if (!valid_character(document.groupbooking.SuitTriple,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.SuitTriple.value=0;
    return false;

}
if (!valid_character(document.groupbooking.SuitQuad,"0123456789")) {

    alert("only numeric allowed");
    document.groupbooking.SuitQuad.value=0;
    return false;

}

if(thiss == document.groupbooking.NoOfCabins) {

    document.groupbooking.IntDouble.value = parseInt(thiss.value);
    document.groupbooking.Interior.value = parseInt(thiss.value);
   
    if(!actualpassengers()){

        document.groupbooking.IntSingle.focus();
        return false;
}


} else if (thiss == document.groupbooking.OceanView ) {
 var OceanView123=document.groupbooking.OceanView.value;
        var input=document.groupbooking.Interior.value;
  document.groupbooking.Interior.value=(parseInt(input)-parseInt(OceanView123));      
  document.groupbooking.IntDouble.value=(parseInt(document.groupbooking.IntDouble.value)-parseInt(OceanView123));  
  document.groupbooking.OcnDouble.value= OceanView123;    
        if(!actualpassengers()){
   
            document.groupbooking.OcnSingle.focus();
            return false;
}
}else if (thiss == document.groupbooking.IntSingle ) {
        var IntSin=document.groupbooking.IntSingle.value;
        var input=document.groupbooking.Interior.value;
        //var input=document.groupbooking.IntDouble.value;
        var IntDb1=document.groupbooking.IntDouble.value;


  //document.groupbooking.IntDouble.value = parseInt(input)-parseInt(thiss.value);
  var IntDbS = parseInt(input)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
 
  if(IntDbS<0){
 
  document.groupbooking.IntSingle.value=0;
  document.groupbooking.IntDouble.value= parseInt(input)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
 
  }else{
  document.groupbooking.IntDouble.value=IntDbS;
  }
  var IntTot=((parseInt(document.groupbooking.IntDouble.value))+(parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)))
  if(input==IntTot)
  {
  document.groupbooking.Interior.value=input;
  }else{
  alert("the cabin numbers exceeds pls check");
 
 
 
  document.groupbooking.IntDouble.focus();
  }

  if(!actualpassengers()){

      document.groupbooking.IntSingle.focus();
      return false;
   }
 
   //alert("You have changed the value to " + thiss.value );

 document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))));
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
document.groupbooking.OceanView.value=((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnDouble.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));
if(document.groupbooking.OceanView.value==0) {
document.groupbooking.OcnSingle.value=0;
document.groupbooking.OcnDouble.value=0;
document.groupbooking.OcnTriple.value=0;
document.groupbooking.OcnQuad.value=0;
}

  } else if (thiss == document.groupbooking.IntTriple  ) {
 
  var input=document.groupbooking.Interior.value;
    //var input=document.groupbooking.IntDouble.value;
 
    //document.groupbooking.IntDouble.value = parseInt(input)-parseInt(thiss.value);
   var IntDbT =  parseInt(input)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
   
    if(IntDbT<0){
   
    document.groupbooking.IntTriple.value=0;
    document.groupbooking.IntDouble.value= parseInt(input)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
    }else{
    document.groupbooking.IntDouble.value=IntDbT;
    }
    var IntTot=((parseInt(document.groupbooking.IntDouble.value))+(parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)))
    if(input==IntTot)
    {
    document.groupbooking.Interior.value=input;
    }else{
    alert("the cabin numbers exceeds pls check");
   
   
   
    document.groupbooking.IntDouble.focus();
    }
 
    if(!actualpassengers()){
 
        document.groupbooking.IntSingle.focus();
        return false;
     }if(IntDbT<0){
     document.groupbooking.IntTriple.focus();
     }
 
     //alert("You have changed the value to " + thiss.value );
   document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
document.groupbooking.OceanView.value=((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnDouble.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));


  }else if( thiss == document.groupbooking.IntQuad ) {
  var input=document.groupbooking.Interior.value;
      //var input=document.groupbooking.IntDouble.value;
   var IntDb3= document.groupbooking.IntDouble.value;
      //document.groupbooking.IntDouble.value = parseInt(input)-parseInt(thiss.value);
     var IntDbQ = parseInt(input)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
     
      if(IntDbQ<0){
     
      document.groupbooking.IntQuad.value=0;
      document.groupbooking.IntDouble.value= parseInt(input)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
      }else{
      document.groupbooking.IntDouble.value=IntDbQ;
      }
      var IntTot=((parseInt(document.groupbooking.IntDouble.value))+(parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)))
      if(input==IntTot)
      {
      document.groupbooking.Interior.value=input;
      }else{
      alert("the cabin numbers exceeds pls check");
     
     
     
      document.groupbooking.IntDouble.focus();
      }
   
      if(!actualpassengers()){
   
          document.groupbooking.IntSingle.focus();
          return false;
       }
       if(IntDb<0){
       document.groupbooking.IntQuad.focus();
       }
   
       //alert("You have changed the value to " + thiss.value );
     document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

  }
 
 
 
 
 
 
  //////////////////////////////////////////////////////////////////////////////////////////////
 
  else if(thiss == document.groupbooking.OcnSingle){  

    var input=document.groupbooking.OceanView.value;
   
     var OcnDbS = parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));

 if(OcnDbS<0){
 
  document.groupbooking.OcnSingle.value=0;
  document.groupbooking.OcnDouble.value=parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));
  }else{
  document.groupbooking.OcnDouble.value=OcnDbS;
  }
  var OcnTot=((parseInt(document.groupbooking.OcnDouble.value))+(parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)))
  if(input==OcnTot)
  {
  document.groupbooking.OceanView.value=input;
  }else{
  alert("the cabin numbers exceeds pls check")
  document.groupbooking.OcnSingle.focus();
  }
 
 if(!actualpassengers()){

      document.groupbooking.OcnDouble.focus();
      return false;
     }
     document.groupbooking.OcnDouble.value=OcnDbS;
    if(OcnDb<0){
     document.groupbooking.OcnSingle.focus();
     }
      document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
if(document.groupbooking.OceanView.value==0) {
document.groupbooking.OcnSingle.value=0;
document.groupbooking.OcnDouble.value=0;
document.groupbooking.OcnTriple.value=0;
document.groupbooking.OcnQuad.value=0;
}
   }else if(thiss == document.groupbooking.OcnTriple ){
   
   var input=document.groupbooking.OceanView.value;
       
        var OcnDbT = parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));
   
    if(OcnDbT<0){
     
     document.groupbooking.OcnTriple.value=0;
     document.groupbooking.OcnDouble.value=parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));;
     }else{
     document.groupbooking.OcnDouble.value=OcnDbT;
     }
     var OcnTot=((parseInt(document.groupbooking.OcnDouble.value))+(parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)))
     if(input==OcnTot)
     {
     document.groupbooking.OceanView.value=input;
     }else{
     alert("the cabin numbers exceeds pls check")
     document.groupbooking.OcnSingle.focus();
     }
     
    if(!actualpassengers()){
   
         document.groupbooking.OcnDouble.focus();
         return false;
        }
        document.groupbooking.OcnDouble.value=OcnDbT;
       if(OcnDbT<0){
        document.groupbooking.OcnTriple.focus();
     }
    document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
if(document.groupbooking.OceanView.value==0) {
document.groupbooking.OcnSingle.value=0;
document.groupbooking.OcnDouble.value=0;
document.groupbooking.OcnTriple.value=0;
document.groupbooking.OcnQuad.value=0;
}
   }else if(thiss == document.groupbooking.OcnQuad ){
   
    var input=document.groupbooking.OceanView.value;
           
            var OcnDbQ = parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));
       
        if(OcnDbQ<0){
         
         document.groupbooking.OcnQuad.value=0;
         document.groupbooking.OcnDouble.value=parseInt(input)-((parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)));
         }else{
         document.groupbooking.OcnDouble.value=OcnDbQ;
         }
         var OcnTot=((parseInt(document.groupbooking.OcnDouble.value))+(parseInt(document.groupbooking.OcnSingle.value))+(parseInt(document.groupbooking.OcnTriple.value))+(parseInt(document.groupbooking.OcnQuad.value)))
         if(input==OcnTot)
         {
         document.groupbooking.OceanView.value=input;
         }else{
         alert("the cabin numbers exceeds pls check")
         document.groupbooking.OcnSingle.focus();
         }
         
        if(!actualpassengers()){
       
             document.groupbooking.OcnDouble.focus();
             return false;
            }
            document.groupbooking.OcnDouble.value=OcnDbQ;
           if(OcnDbQ<0){
            document.groupbooking.OcnQuad.focus();
         }
    document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

  ////////////////////////////////////////////////////////////////////////////
   if(document.groupbooking.OceanView.value==0) {
   document.groupbooking.OcnSingle.value=0;
   document.groupbooking.OcnDouble.value=0;
   document.groupbooking.OcnTriple.value=0;
   document.groupbooking.OcnQuad.value=0;
}
   } else if (thiss == document.groupbooking.BlySingle) {

     
     var input=document.groupbooking.Balcony.value;

   
     
     var BalDbS= parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
     
     if(BalDbS<0){
     document.groupbooking.BlySingle.value=0;
       document.groupbooking.BlyDouble.value=parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
       }else{
       document.groupbooking.BlyDouble.value=BalDbS;
       }
       var BlyTot=((parseInt(document.groupbooking.BlyDouble.value))+(parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)))
       if(input==BlyTot)
       {
       document.groupbooking.Balcony.value=input;
       }else{
       alert("the cabin numbers exceeds pls check")
       
  }
     
     
   
     if(!actualpassengers()) {

      document.groupbooking.OcnTriple.focus();
      return false;
     }
     document.groupbooking.BlyDouble.value=parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
     document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
if(document.groupbooking.Balcony.value==0) {
   document.groupbooking.BlySingle.value=0;
   document.groupbooking.BlyDouble.value=0;
   document.groupbooking.BlyTriple.value=0;
   document.groupbooking.BlyQuad.value=0;
}
    } else if(thiss == document.groupbooking.BlyTriple) {
   
    var input=document.groupbooking.Balcony.value;
   
       
         
         var BalDbT= parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
         
         if(BalDbT<0){
         document.groupbooking.BlyTriple.value=0;
           document.groupbooking.BlyDouble.value=parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
           }else{
           document.groupbooking.BlyDouble.value=BalDbT;
           }
           var BlyTot=((parseInt(document.groupbooking.BlyDouble.value))+(parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)))
           if(input==BlyTot)
           {
           document.groupbooking.Balcony.value=input;
           }else{
           alert("the cabin numbers exceeds pls check")
           
      }
         
         
       
         if(!actualpassengers()) {
   
          document.groupbooking.OcnTriple.focus();
          return false;
         }
     document.groupbooking.BlyDouble.value=parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
     document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
if(document.groupbooking.Balcony.value==0) {
   document.groupbooking.BlySingle.value=0;
   document.groupbooking.BlyDouble.value=0;
   document.groupbooking.BlyTriple.value=0;
   document.groupbooking.BlyQuad.value=0;
}
   } else if(thiss == document.groupbooking.BlyQuad) {
   
    var input=document.groupbooking.Balcony.value;
       
           
           
            var BalDbQ= parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
           
            if(BalDbQ<0){
            document.groupbooking.BlyQuad.value=0;
              document.groupbooking.BlyDouble.value=parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
              }else{
              document.groupbooking.BlyDouble.value=BalDbQ;
              }
              var BlyTot=((parseInt(document.groupbooking.BlyDouble.value))+(parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)))
              if(input==BlyTot)
              {
              document.groupbooking.Balcony.value=input;
              }else{
              alert("the cabin numbers exceeds pls check")
             
         }
           
           
           
            if(!actualpassengers()) {
       
             document.groupbooking.OcnTriple.focus();
             return false;
            }
     document.groupbooking.BlyDouble.value=parseInt(input)-((parseInt(document.groupbooking.BlySingle.value))+(parseInt(document.groupbooking.BlyTriple.value))+(parseInt(document.groupbooking.BlyQuad.value)));
   
     document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));
if(document.groupbooking.Balcony.value==0) {
   document.groupbooking.BlySingle.value=0;
   document.groupbooking.BlyDouble.value=0;
   document.groupbooking.BlyTriple.value=0;
   document.groupbooking.BlyQuad.value=0;
}
    }
   
   
  //////////////////////////////////////////////////////////////////////////////////////////
   
    else if (thiss == document.groupbooking.SuitSingle){

         
          var input=document.groupbooking.Suites.value;
         
          var SuitDbS = parseInt(input)-((parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)));
           
           
           if(SuitDbS<0){
                   document.groupbooking.SuitSingle.value=0;
                document.groupbooking.SuitDouble.value= parseInt(input)-((parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)));;
                }else{
                document.groupbooking.SuitDouble.value=SuitDbS;
                }
                var SuitTot=((parseInt(document.groupbooking.SuitDouble.value))+(parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)))
                if(input==SuitTot)
                {
                document.groupbooking.Suites.value=input;
                }else{
                alert("the cabin numbers exceeds pls check")
                document.groupbooking.SuitSingle.focus();
  }
           
           
           
           
         if(!actualpassengers()){

          document.groupbooking.OcnTriple.focus();
          return false;
         }
          document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

      } else if (thiss == document.groupbooking.SuitTriple){

         
          var input=document.groupbooking.Suites.value;
         
          var SuitDbT = parseInt(input)-((parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)));
           
           
           if(SuitDbT<0){
                   document.groupbooking.SuitTriple.value=0;
                document.groupbooking.SuitDouble.value= parseInt(input)-((parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)));;
                }else{
                document.groupbooking.SuitDouble.value=SuitDbT;
                }
                var SuitTot=((parseInt(document.groupbooking.SuitDouble.value))+(parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)))
                if(input==SuitTot)
                {
                document.groupbooking.Suites.value=input;
                }else{
                alert("the cabin numbers exceeds pls check")
                document.groupbooking.SuitSingle.focus();
  }
           
           
           
           
         if(!actualpassengers()){

          document.groupbooking.OcnTriple.focus();
          return false;
         }
          document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(input)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

      }else if (thiss == document.groupbooking.SuitQuad){

         
          var input=document.groupbooking.Suites.value;
         
          var SuitDbQ = parseInt(input)-((parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)));
           
           
           if(SuitDbQ<0){
                   document.groupbooking.SuitQuad.value=0;
                document.groupbooking.SuitDouble.value= parseInt(input)-((parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)));;
                }else{
                document.groupbooking.SuitDouble.value=SuitDbQ;
                }
                var SuitTot=((parseInt(document.groupbooking.SuitDouble.value))+(parseInt(document.groupbooking.SuitSingle.value))+(parseInt(document.groupbooking.SuitTriple.value))+(parseInt(document.groupbooking.SuitQuad.value)))
                if(input==SuitTot)
                {
                document.groupbooking.Suites.value=input;
                }else{
                alert("the cabin numbers exceeds pls check")
                document.groupbooking.SuitSingle.focus();
  }
           
           
           
           
         if(!actualpassengers()){

          document.groupbooking.OcnTriple.focus();
          return false;
         }
     
       document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

      }
     
     
     
     
     
     
     
     
///////////////      
     
     
      else if(thiss == document.groupbooking.OceanView) {
     
            var input=document.groupbooking.Interior.value;
           
          var Ioc= parseInt(input)-parseInt(thiss.value);
          if(Ioc>0){
          document.groupbooking.Interior.value=Ioc;
          }else{
          document.groupbooking.Interior.value=input;
          alert("cabin number exceeds");
          document.groupbooking.OceanView.value=0;
          }
          document.groupbooking.OcnDouble.value = parseInt(thiss.value);
          var Idb1 = parseInt(document.groupbooking.IntDouble.value)-parseInt(thiss.value);
          
          if(Idb1>0)
            {
            document.groupbooking.IntDouble.value = Idb1;
            }else{
            document.groupbooking.IntDouble.value = 0;
            alert("cabin numbers exceeds the limit");
            document.groupbooking.OceanView.focus();
            }
             
           document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
    document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

           
       } else if(thiss == document.groupbooking.Balcony) {

          var input=document.groupbooking.Interior.value;

             var Ibal= parseInt(input)-parseInt(thiss.value);
                     if(Ibal>0){
                     document.groupbooking.Interior.value=Ibal;
                     }else{
                     document.groupbooking.Interior.value=input;
                     alert("cabin number exceeds");
                     document.groupbooking.Balcony.value=0;
          }





           
            var Idb2 = parseInt(document.groupbooking.IntDouble.value)-parseInt(thiss.value);
            if(Idb2>0)
            {
            document.groupbooking.IntDouble.value = Idb2;
            }else{
            document.groupbooking.IntDouble.value = 0;
            alert("cabin numbers exceeds the limit");
            document.groupbooking.Balcony.focus
            }
           
            document.groupbooking.BlyDouble.value = parseInt(thiss.value);
           
             document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

        } else if( thiss == document.groupbooking.Suites) {
       
          var input=document.groupbooking.Interior.value;
          
          var Isuit= parseInt(input)-parseInt(thiss.value);
                               if(Isuit>0){
                               document.groupbooking.Interior.value=Isuit;
                               }else{
                               document.groupbooking.Interior.value=input;
                               alert("cabin number exceeds");
                               document.groupbooking.Suites.value=0;
          }
          
           
               var Idb3 = parseInt(document.groupbooking.IntDouble.value)-parseInt(thiss.value);
            if(Idb3>0)
            {
            document.groupbooking.IntDouble.value = Idb3;
            }else{
            document.groupbooking.IntDouble.value = input;
            alert("cabin numbers exceeds the limit");
            document.groupbooking.Suites.focus();
            }            
            document.groupbooking.SuitDouble.value = parseInt(thiss.value);
         
          }
             document.groupbooking.Interior.value =((parseInt(document.groupbooking.NoOfCabins.value))-((parseInt(document.groupbooking.OceanView.value))+ (parseInt(document.groupbooking.Balcony.value))+(parseInt(document.groupbooking.Suites.value))))
  document.groupbooking.IntDouble.value=parseInt(document.groupbooking.Interior.value)-((parseInt(document.groupbooking.IntSingle.value))+(parseInt(document.groupbooking.IntTriple.value))+(parseInt(document.groupbooking.IntQuad.value)));

 }
 

function actualpassengers() {


    var InteriorSingle = document.groupbooking.IntSingle.value ;
    var OceanSingle    =   document.groupbooking.OcnSingle.value;
    var BalconySingle = document.groupbooking.BlySingle.value;
    var SuiteSingle= document.groupbooking.SuitSingle.value;
 
    var InteriorDouble = document.groupbooking.IntDouble.value ;
    var OceanDouble   =   document.groupbooking.OcnDouble.value;
    var BalconyDouble = document.groupbooking.BlyDouble.value;
    var SuiteDouble = document.groupbooking.SuitDouble.value;
 
    var InteriorTriple = document.groupbooking.IntTriple.value ;
    var OceanTriple   =   document.groupbooking.OcnTriple.value;
    var BalconyTriple = document.groupbooking.BlyTriple.value;
    var SuiteTriple= document.groupbooking.SuitTriple.value;
 

    var InteriorQuad = document.groupbooking.IntQuad.value ;
    var OceanQuad  =   document.groupbooking.OcnQuad.value;
    var BalconyQuad = document.groupbooking.BlyQuad.value;
    var SuiteQuad= document.groupbooking.SuitQuad.value;
   
   
   
    var iSingleTotal  = (parseInt(InteriorSingle) + parseInt(OceanSingle) + parseInt(BalconySingle) + parseInt(SuiteSingle)) ;
    var iDoubleTotal  = (parseInt(InteriorDouble) + parseInt(OceanDouble) + parseInt(BalconyDouble) + parseInt(SuiteDouble)) ;
    var iTripleTotal  = (parseInt(InteriorTriple) + parseInt(OceanTriple) + parseInt(BalconyTriple) + parseInt(SuiteTriple)) ;
    var iQuadTotal    = (parseInt(InteriorQuad) + parseInt(OceanQuad) + parseInt(BalconyQuad) + parseInt(SuiteQuad)) ;

    document.groupbooking.Actual.value = (( iSingleTotal)+ (( iDoubleTotal)*2) +((iTripleTotal)*3) + ((iQuadTotal)*4));

    if(parseInt(document.groupbooking.Actual.value) != parseInt(document.groupbooking.Passengers.value)) {
   
    document.groupbooking.Submit2.disabled=true;
    } else {
     
      document.groupbooking.Submit2.disabled=false;
    }
}



function valid_character(field,strAllowed) {

    var strCheck = field.value;
    var flag = 0;
    for (i = 0; i < strCheck.length; i++) {

    if (strAllowed.indexOf(strCheck.substr(i,1)) == -1) {

        flag = 1

    }

}

if(flag==1) {

    return false;

} else {

   return true;
  }

}

function echeck() {

    var c= document.groupbooking.Email.value;
    var d = document.groupbooking.Email.value.substr(0,1);



    /* Email validation */

    if ((c !="") && (d!=" ")) {

        if (document.groupbooking.Email.value.length<5) {

            alert("Email should be atleast 5 char") ;
            document.groupbooking.Email.value="";
            document.groupbooking.Email.focus();
            return false;

        }

    if (document.groupbooking.Email.value.length >= 5) {

        var flag="false";

        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.groupbooking.Email.value)) {

            flag="true";

        }

        if(flag == "false") {

            alert("Invalid E-mail Address! Please re-enter.");
            document.groupbooking.Email.select();
            return (false);
      }

     }

}



    return true;

}

 

 



function Validate(){

    if (document.groupbooking.GroupName.value=="") {
                       
        alert("Please Enter GroupName");
        document.groupbooking.GroupName.focus();
        return false;
    }

    if (!valid_character(document.groupbooking.GroupName,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) {
                     
        alert("Invalid Entry for GroupName");
        document.groupbooking.GroupName.focus();
        return false;
    }

    if (document.groupbooking.FirstName.value=="") {
               
        alert("Please Enter FirstName");
      document.groupbooking.FirstName.focus();
        return false;
     }
     
    if (!valid_character(document.groupbooking.FirstName,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) {
       
        alert("Invalid Entry for FirstName");
        document.groupbooking.FirstName.focus();
        return false;

    }
   
    if (document.groupbooking.LastName.value=="") {
   
       alert("Please Enter LastName");
       document.groupbooking.LastName.focus();
       return false;
    }

    if (!valid_character(document.groupbooking.LastName,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) {
   
        alert("Invalid Entry for LastName");
      document.groupbooking.LastName.focus();
      return false;

    }  
       
       
    if (document.groupbooking.PhoneNo.value =="") {      
             
        alert("Please Enter PhoneNumber");
      document.groupbooking.PhoneNo.focus();
      return false;

     }    
             
    if (!valid_character(document.groupbooking.PhoneNo,"-0123456789")) {    
               
       alert("Invalid Entry for PhoneNumber");
       document.groupbooking.PhoneNo.focus();
       return false;
       
     }  


    if (!valid_character(document.groupbooking.Extn,"0123456789")) {

      alert("Invalid Entry for Extension");
      document.groupbooking.Extn.focus();
      return false;

    }    
       
       
    if (document.groupbooking.Home.value =="") {

      alert("Please Enter HomePhone");
      document.groupbooking.Home.focus();
      return false;

    }    

    if (!valid_character(document.groupbooking.Home,"-0123456789")) {

      alert("Invalid Entry for HomePhone");
      document.groupbooking.Home.focus();
      return false;

     }
     
     if(document.groupbooking.Email.value =="") {

         alert("Please Enter Email");
       document.groupbooking.Email.focus();
       return false;
     }      
       

    if(!echeck()) {

      document.groupbooking.Email.focus();
      return false;
     }
 
    if (!valid_character(document.groupbooking.Amenities,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) {

        alert("Invalid Entry for Amenities");
      document.groupbooking.Amenities.focus();
      return false;
    }
   if(!validateText()) {
   
   alert('Your comments must be 1000 characters or less');
   check=false;
   
   }
      
    if (document.groupbooking.NoOfCabins.value =="") {
      
            alert("Please Enter No: of Cabins");
            document.groupbooking.NoOfCabins.focus();
            return false;
      
    }  
    if (document.groupbooking.Passengers.value =="") {
          
                alert("Please Enter Given");
                document.groupbooking.Passengers.focus();
                return false;
          
    }
   
      if(check==true) {
      
    document.groupbooking.method="post";
    document.groupbooking.action="Cntl?do=CAPTGRPINFO";
    document.groupbooking.submit;
            
}            
            
            

       
}

function validateText() {
     maxlength=1000;
     if(document.groupbooking.theNotes.value.length>=maxlength) {
         
          document.groupbooking.theNotes.focus();
          return false;
     } else {
          return true;
     }
}


</script>

<title>Capture Group Information</title>
<!-- this for the top link-->

<%@ include file = "Header.jsp"%>

<!-- this for the top link-->
<tr>
          <td height="0" align="center" valign="top" bgcolor="#FFFFFF">
            <table width="99%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="8" colspan="4"><img src="images/empty.gif" width="1" height="1"></td>
              </tr>
              <tr>
                <td width="14%" height="19" valign="top" background="images/form_bg2.jpg"><img src="images/group_info.jpg" width="267" height="19"></td>

<!-- the side link jsp of Group booking-->

<%@ include file = "leftlink.jsp"%>

<!-- the side link jsp of Group booking-->  
<form name="groupbooking">
                           

                            <td width="1" valign="top" background="images/dot_line.jpg"><img width="1" height="3"><img src="images/empty.gif" width="1" height="1"></td>
                            <td width="790" height="0" align="center" valign="top" bgcolor="d9f0ff">
<table width="100%" border="0" cellpadding="6" cellspacing="1">
                                <tr>
                                  <td height="31" colspan="2" bgcolor="#FFFFFF">
<table width="80%" border="0" cellspacing="0" cellpadding="3">
                                      <tr>
                                        <td width="20%" class="top">* Group Name
                                          : </td>
                                          <%
                                         
                                          session.setAttribute("AgentName","Savitha");
                                         
                                         
                                          if(request.getParameter("GroupName")!=null){ %>
                                        <td width="24%"><input name="GroupName" type="text" class="field" maxlength="30" value="<%=request.getParameter("GroupName")%>"></td>
                                        <%}else{%>
                                        <td width="24%"><input name="GroupName" type="text" class="field"maxlength="30"  ></td>
                                         <%}%><td width="9%" class="top">Date : </td>
                                        <td width="20%"><input name="Date" type="text"value="<%=date1%>" class="field" readonly></td>
                                        <td width="9%" class="top">Time : </td>
                                        <td width="18%"><input name="Time" type="text" value="<%=time%>" class="field" size="15" readonly></td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td width="19%" bgcolor="#FFFFFF" class="contenthead"><div align="right">Group Leader Name :</div></td>
                                  <td width="71%" bgcolor="#FFFFFF"> <table width="88%" border="0" cellspacing="0" cellpadding="3">
                                      <tr>
                                        <td width="16%" class="content1">* First Name :</td>
                                       <% if(request.getParameter("FirstName")!=null){ %>
                                        <td width="27%"><input name="FirstName" type="text" class="field"maxlength="20" value="<%=request.getParameter("FirstName")%>"></td>
                                        <%}else{%>
                                        <td width="27%"><input name="FirstName" type="text" class="field"  maxlength="20"></td>
                                        <%}%>
                                        <td width="19%" class="content1">* Last Name : </td>
                                        <% if(request.getParameter("LastName")!=null){ %>
                                        <td width="38%"><input name="LastName" type="text" class="field" maxlength="20" value="<%=request.getParameter("LastName")%>"></td>
                                        <%}else{%>
                                        <td width="38%"><input name="LastName" type="text" class="field" maxlength="20"></td>
                                        <%}%>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td bgcolor="#FFFFFF" class="content1">* Phone
                                    : </td>
                                  <td bgcolor="#FFFFFF"><table width="87%" border="0" cellspacing="2" cellpadding="3">
                                      <tr>
                                      <% if(request.getParameter("PhoneNo")!=null){ %>
                                        <td width="28%"><input name="PhoneNo" type="text" class="field" maxlength="15" value="<%=request.getParameter("PhoneNo")%>"></td>
                                        <%}else{%>
                                        <td width="28%"><input name="PhoneNo" type="text" class="field" maxlength="15"></td>
                                        <%}%>
                                        <td width="11%" class="content1">Extn
                                          : </td>
                                          <% if(request.getParameter("Extn")!=null){ %>
                                        <td width="18%"><input name="Extn" type="text" class="field" size="15" maxlength="10" value="<%=request.getParameter("Extn")%>"></td>
                                        <%}else{%>
                                        <td width="18%"><input name="Extn" type="text" class="field" size="15" maxlength="10"></td>
                                        <%}%>
                                        <td width="12%" class="content1">* Home:
                                        </td>
                                        <% if(request.getParameter("Home")!=null){ %>
                                        <td width="31%"><input name="Home" type="text" class="field" size="15"maxlength="20" value="<%=request.getParameter("Home")%>"></td>
                                        <%}else{%>
                                        <td width="31%"><input name="Home" type="text" class="field" size="15" maxlength="20"></td>
                                        <%}%>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                               
                                  <td bgcolor="#FFFFFF" class="content1">* Email :</td>
                                  <% if(request.getParameter("Email")!=null){ %>
                                  <td bgcolor="#FFFFFF"> <input name="Email" type="text" class="field" size="40" maxlength="50" value="<%=request.getParameter("Email")%>"></td>
                                  <%}else{%>
                                  <td bgcolor="#FFFFFF"> <input name="Email" type="text" class="field" size="40" maxlength="50"></td>
                                  <%}%>
                                </tr>
                                <tr>
                                  <td bgcolor="#FFFFFF" class="content1">Airport
                                    Code :</td>
                                  <td bgcolor="#FFFFFF"> <table width="88%" border="0" cellspacing="0" cellpadding="3">
                                      <tr>
                                        <td width="12%"><select name="airportSelected" multiple class="field" size="1">
                                            <option >RDU</option>
                                            <option>laya</option>
                                            <option>fgd</option>
                                            <option>dgd</option>
                                          </select></td>
                                        <td width="10%"><input name="Submit" type="submit" class="field" value="ADD" ></td>
                                       <% if(null!=strAirportCode) {%>
                                        <td width="19%"> <input name="airportCode" type="text" class="field" maxlength="30" value="<%=strAirportCode%>" size="10">
                                        </td><%}else{%>
                                        <td width="19%"> <input name="airportCode" type="text" class="field" value=" " maxlength="30" size="10">
                                        </td><%}%>
                                       
                                        <td width="26%" class="content1">Is Transfer
                                          Needed : </td>
                                        <td width="33%"><select name="select" class="field">
                                            <option value="Y">Yes</option>
                                            <option value="N">No</option>
                                          </select></td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td bgcolor="#FFFFFF" class="content1">Purpose
                                    : </td>
                                  <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td width="15%"><select name="select2" class="field">
                                            <option value="A"selected>Affinity</option>
                                            <option value="I">Incentive</option>
                                          </select></td>
                                        <td width="16%" class="content1">Amenities:&nbsp;
                                        </td>
                                        <%if(request.getParameter("Amenities")!=null){%>
                              <td width="69%"><input name="Amenities" type="text" class="field" maxlength="30" value="<%=request.getParameter("Amenities")%>"></td>
                              <%}else{%>
                              <td width="69%"><input name="Amenities" type="text" class="field" maxlength="30" value=""></td>
                                        <%}%>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td bgcolor="#FFFFFF" class="content1">Preferred
                                    Dining Time : </td>
                                  <td bgcolor="#FFFFFF"><select name="select15" class="field">
                                      <option value="L">Late Dining</option>
                                      <option value="E">Early Dining</option>
                                    </select></td>
                                </tr>
                                <tr>
                                  <td colspan="2" bgcolor="#FFFFFF" class="content1"><table width="100%" border="0" cellspacing="0" cellpadding="2">
                                      <tr>
                                        <td colspan="2" class="content1">No of
                                          Cabins :</td>
                                        <td width="22%"><input name="NoOfCabins" type="text" size="2"  class="field" maxlength="4" onChange='valid(this)' >
                                           
                                          </select></td>
                                        <td width="10%" rowspan="3" valign="top" class="content1">Notes
                                          :</td>
                                        <td width="36%" rowspan="3"><textarea name="theNotes" cols="50" rows="5" class="field" ></textarea></td>
                                      </tr>
                                      <tr>
                                        <td width="21%" rowspan="2" valign="top" class="contenthead">No
                                          of Passengers (# PAX)</td>
                                        <td width="11%" height="30" class="content1">Given :</td>
                                        <td width="22%"><input name="Passengers" type="text" class="field" size="15" onChange='valid(this)'></td>
                                      </tr>
                                      <tr>
                                        <td height="22" class="content1">Actual :</td>
                                        <td width="22%"><input name="Actual" size="2"  class="field" maxlength="4" readonly>
                                           
                                          </td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td colspan="2" valign="top" bgcolor="#FFFFFF">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td height="114" valign="top" bgcolor="99d5e2"><table width="100%" border="0" cellpadding="4" cellspacing="1">
                                            <tr bgcolor="#ECF9FF">
                                              <td colspan="2" class="contenthead">Category</td>
                                              <td width="23%">&nbsp; </td>
                                              <td width="12%" class="contenthead">Single</td>
                                              <td width="10%" class="contenthead">Double</td>
                                              <td width="11%" class="contenthead">Triple</td>
                                              <td width="15%" class="contenthead">Quad</td>
                                              <td width="15%" class="contenthead">&nbsp;</td>
                                            </tr>
                                            <tr bgcolor="C0E6EB">
                                              <td width="6%" class="content1">&nbsp;</td>
                                              <td width="14%" align="left" class="content1">
                                                <div align="left">Interior</div></td>
                                              <td> <input name="Interior" type="text" class="field" value="" size="8" readonly onChange='valid(this)'>
                                              </td>
                                              <td><input name="IntSingle" type="text" class="field" value="0" size="8" maxlength="4"  onChange='valid(this)'></td>
                                              <td> <input name="IntDouble" type="text" class="field" value="0" size="10" readonly></td>
                                              <td> <input name="IntTriple" type="text" class="field" value="0" size="8" maxlength="4"  onChange='valid(this)'></td>
                                              <td><input name="IntQuad" type="text" class="field" value="0" size="8" maxlength="4"  onChange='valid(this)'>
                                         </td>
                                              <td>&nbsp; </td>
                                            </tr>
                                            <tr bgcolor="#ECF9FF">
                                              <td bgcolor="#ECF9FF" class="content1">&nbsp;</td>
                                              <td align="left" class="content1">
                                                <div align="left">Ocean View</div></td>
                                              <td> <input name="OceanView" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td><input name="OcnSingle" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td> <input name="OcnDouble" type="text" class="field" value="0" size="10" readonly></td>
                                              <td> <input name="OcnTriple" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td><input name="OcnQuad" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'>
                                              </td>
                                              <td>&nbsp; </td>
                                            </tr>
                                            <tr bgcolor="C0E6EB">
                                              <td class="content1">&nbsp;</td>
                                              <td align="left" class="content1">
                                                <div align="left">Balcony</div></td>
                                              <td> <input name="Balcony" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td><input name="BlySingle" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td> <input name="BlyDouble" type="text" class="field" value="0" size="8" readonly></td>
                                              <td> <input name="BlyTriple" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td><input name="BlyQuad" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'>
                                              </td>
                                              <td>&nbsp; </td>
                                            </tr>
                                            <tr bgcolor="#ECF9FF">
                                              <td class="content1">&nbsp;</td>
                                              <td align="left" class="content1">
                                                <div align="left">Suites</div></td>
                                              <td> <input name="Suites" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td><input name="SuitSingle" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td> <input name="SuitDouble" type="text" class="field" value="0" size="8" readonly></td>
                                              <td> <input name="SuitTriple" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'></td>
                                              <td><input name="SuitQuad" type="text" class="field" value="0" size="8" maxlength="4" onChange='valid(this)'>  
                                              </td>
                                              <td>&nbsp; </td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr>
                                  <td height="32" bgcolor="#FFFFFF">&nbsp;</td>
                                  <td bgcolor="#FFFFFF"><div align="center">
                                      <p class="leftpanetext">
                                        <input name="Submit2" type="submit" class="field" value="Continue"onClick="return Validate();"  >
                                        </a></a></p>
                                    </div></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td height="0" align="center" valign="top"><img src="images/ht.gif" width="2" height="15"></td>
        </tr>
       
       
        <%
        session.setAttribute("airport",strAirportCode);%>
        <%@ include file = "Footer.jsp"%>
  </form>


 here is my full code if u could help me it would be gr8..... i know it is not a neat work pls dont mind....
thanks
0
 
surajgupthaAuthor Commented:
sajuks,
thank u so much for going through my code suggesting a solution i ll try this one..and reply.. will it take care of the primary problem which i asked
0
 
surajgupthaAuthor Commented:
it gives an error " thisElement " is undefined where i am already it as u said..what could be the reason
0
 
sajuksCommented:
it needs to be defined ias a global variable in ur javascript did u do that

<SCRIPT LANGUAGE="JavaScript">
  <!--
     var thisElement=null;  //<< note this
function valid(thiss) {
0
 
surajgupthaAuthor Commented:
sajuks,

i did that yesterday... still its giving the same error i feel its bcoz of this
<input onfocus='thisElement=this;' name="OcnSingle" type="text" class="field"
value="0" size="8" maxlength="4" onblur='setTimeout("valid(thisElement)",1);'>
here********* onblur='setTimeout("valid(thisElement)",1);' ***********
 pls tell me how to go about it...thank u
0
 
sajuksCommented:
can u post the code again that u've currently now,( post the page thats gets generated after ur jsp execution so that we've
pure html code )
 a link would be better cos u've got lots of lines of codes
U could psot these at http://www.yousendit.com/ so that others can also reference it
just post the link here
0
 
surajgupthaAuthor Commented:
when i declare it out side the script it says object expected... could u pls help me..
0
 
surajgupthaAuthor Commented:
it still says thisElement is undefined
0
 
surajgupthaAuthor Commented:
sajuks,
 good morning...
   when i am just using 1* instead of parseInt it gives an error "object expected"  i am stuck in this page could pleeeeez help me out .... hoping to get a reply soon
thanks
0
 
surajgupthaAuthor Commented:
sajuks,

i have send my file to sajuks@rediffmail.com pls checkand do reply me.. i have posted it through yousendit.com thanks
0
 
surajgupthaAuthor Commented:
Still that onblur and onfocus does not work...
0
 
surajgupthaAuthor Commented:
i am refreshing the page now it works..
0
 
sajuksCommented:
sorry surajguptha , i was waiting for the file link for the past few days and when u send it i was not available.
Glad u worked it out.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.