< META HTTP-EQUIV="Expires" CONTENT="0"> - any # less than 1 means no cache
< META HTTP-EQUIV="Pragma" CONTENT="no-cache"> - for backward compatability
< META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> - for HTTP 1.1 spec
day in Date
function fnGetPrevDayDate(objDate){
// 1 day = 86400000 ms
// var datPrevDate = new Date(objDate.getTime() - 86400000);
// code above returns incorrect result when time changes from DST to standard time
var datPrevDate = new Date(objDate);
datPrevDate.setDate(datPrevDate.getDate() - 1);
return datPrevDate;
}
html:checkbox
-If the form is in session and you change the checkbox from true(checked) to false(unchecked), the checkbox attribute in form is not set back to false. This is because the unchecked checkbox is not sent in the request and is therefore not set in the form.
-solution: Add a reset method in form & reset checkbox to false. Everytime you submit the form, form is reset and then populated before moving to action, thus having correct value for the checkbox.
how to use indexId on logic:iterate
< logic:iterate id="entityRow" name="<%= DerivativeEntityConstantsIF.SEARCH_RESULT %>" scope="session" offset="<%= String.valueOf(offset)%>" length="<%= String.valueOf(maxLength)%>" indexId="indexNum">
< html:select name="entityRow" property="linkageClassCode"
onchange='<%= "fnEditValue(this, " + indexNum + ")" %>' >...
html element default values - defaultValue/defaultSelectedd
if (frm["termDeal.accountNo"].value != frm["termDeal.accountNo"].defaultValue) return true;
if (fnIsSelectChanged(frm["termDeal.currency"])) return true;
function fnIsSelectChanged(selectObj) {
var index = selectObj.selectedIndex;
var selectedOption = selectObj.options[index];
if (selectedOption.defaultSelected) return false;
return true;
}
use popUpCalendar.js
if (!document.layers){
var startDate = document.getElementById("personalInfoForm.dateOfBirth");
// use showCalendarWithHolidays if you want to show holidays
document.write("<[toRemove]a href='javascript:void(0)' onclick='showCalendarWithHolidays(this, startDate, \"mm-dd-yyyy\",null,1,-1,-1, true)'><[toRemove]img src='' border='0'/>");
}
regex of replace
.value.replace(/_|-/g, '') --> replace _ and - with empty str
use of sessionScope
CL.isNewClient = ${sessionScope[ClientConstants.IS_NEW_CLIENT]} --> do not put semi colon at end (not sure if for AMS only)