I basicaly need 3 standard values in my drop down..
1) select ""
2) long term
3) short term
Here is the html code:
Value from the form(sArcfacilityGradeForm.facilityTenorValue) is preselected in the dropdown
Here is the JS Function:
function tenorChange(tenroObj){
var tenor=tenroObj.value;
alert('Changing tenor on screen');
alert('tenor value read from screen is :'+tenor);
//document.forms[0].tenor.value=tenor;
//alert('display tenor value from form'+tenorScrenn);
if (tenor == "") {
alert('Please select a valid tenor');
tenroObj.value=document.forms[0].facilityTenorValue.value;
return false;
}
document.forms[0].tenorScreenValue.value=tenor;
//document.forms[0].facilityTenorValue=tenorScrenn;
document.forms[0].action.value = "changeTenor";
document.forms[0].submit();
}
Input: tenroObj is dropdown object used to display on the screen.
var tenor=tenroObj.value; ==> will contain the value selected
ex: From
if short term -less than or equal to 180 days is selected on the screen, this value contains: 179.
You can only set String values from JS to Form. So here,
tenorScreenValue: Has to be a String value in the Facility Grade Form.
document.forms[0].tenorScreenValue.value=tenor;
Very Important Note: Form values you are trying to set from Java Script must be defined as hidden variables in the JSP or JS wont be able to read them
Ex: