Tuesday, August 28, 2007

Setting Focus to Apt section of the page

DG page has the following:
CI
SI
RI
DG
When user changes a value in RI user shud be brought back to RI, instead of the beginning of the page where he will have to scroll into the apt section.
here is how we'll do id:

Declare div values for each section of your page and

Set the value in ur action class on pg submit

facilityGradeForm.setShowRegClass(true);
facilityGradeForm.setShowCI(false);
facilityGradeForm.setShowGuarantee(false);
facilityGradeForm.setshowOS(false);
facilityGradeForm.setShowDG(false);

Call a generic js fn on pg load to scroll into the div value on submit.
function setAptPageFocus(){

//alert("IN apt page focus");
//alert(document.forms[0].showGuarantee.value);
if (document.forms[0].showGuarantee.value=="true"){
//alert("In Show Guarantee");
divShowGuarantee.scrollIntoView();
}

if (document.forms[0].showOS.value=="true"){
//alert("In Show OS");
divShowOtherSupport.scrollIntoView();
}

if (document.forms[0].showRegClass.value=="true"){
//alert("In SHow Reg Class");
divShowRegClass.scrollIntoView();
}

if (document.forms[0].showCI.value=="true"){
//alert("In SHow CI");
divShowingCI.scrollIntoView();
}

}

Each page submit will take you to apt section of the page yay.!!

No comments: