SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Disappearing form field values

    Be gentle please as this is my first ever Javascript programming attempt.

    Basically I am trying to make a simple mortgage calculator and I am experiencing a problem where all the text in the form fields are disappearing.

    Hopefully someone can point out the error I am making?

    Here is the link to my test file

    http://www.mediakitchen.co.uk/testCalculator.htm

    If you enter values into the first 3 fields then click the "Calculate" button, all the values in the first 3 fields disappear.

    Thanks in advance

    Paul

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,185
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    syntax

    You may have better luck using DOM syntax. Instead of like this
    HTML Code:
    var mortgageRequired=form.mortgageRequired.value; // Principal amount
    try this way
    HTML Code:
    var mortgageRequired = document.getElementById('mortgageRequired').value; // Principal amount

  3. #3
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Taunton, UK
    Posts
    787
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Mittineaque - I will give that a go as I have failed to get to the bottom of the problem with my existing code.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •