ASPRUNNER 5.1 build 327
DB - Access 2000
I'm trying to perform an javascript onchange event for a field on a Add/edit page (both) and
I have followed the instructions at the following link:
http://www.asprunner.com/forums/index.php?...amp;hl=onchange
Here are the fields:
NUM_SHIP (description - Number shipped) (LongInt)
PER_MORT (description - Percent Mortality) (double)
NUM_STOCK (description - Number Stocked) (LongInt)
Here is what I did:
- built the project
- edited include/jsfunctions.js and added the following function
function UpdateNumStock_Edit()
{
document.editform.NUM_STOCK.value = document.editform.PER_MORT.value *
document.editform.NUM_SHIP.value;
}
- edited include/aspfunctions.asp as per the link above as follows (my changes in bold):
BuildEditControl =""
if sFieldName="PER_MORT" then
onchange = " onchange=""UpdateNumStock_Edit();"" "
end if
Select Case sFormat
Case EDIT_FORMAT_TEXT_FIELD
BuildEditControl = "<input type=text name=""" & sFieldName & """" & GetEditParams(sFieldName) & " value=""" & sDefault & """" & onchange & ">"
- Opened the page in Firefox
- Went to both the add and edit pages and entered values for NUM_SHIP and PER_MORT, but there was no auto update for NUM_STOCK field on either page.
Also, when I viewed the page source ..._add.asp and.. edit.asp , there was no "onchange" event information attached to the field definitions. I also noticed that the "name=" arguments had "value" in front of the field name (ie. value_PER_MORT).
I feel I'm missing something. Any insight is appreciated. Thanks