This topic is locked

Edit/Add OnChange Question

4/2/2008 11:55:22 AM
ASPRunnerPro General questions
T
tlitts13 author

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:

  1. built the project
  2. 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;

    }
  3. 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 & ">"
  4. Opened the page in Firefox
  5. 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

J
Jane 4/4/2008

answered in your personal email.