SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    England
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getting the page to reload on clicking of a javascript alert

    Hello,

    I have a text field which gets its value from a javascript calculator. This text field shows the total value so I do not want the user to edit it.

    At the moment I have an onchange event which gives an alert when the user changes the value. What I want is for the page to reload once the alert has been pressed.

    The Code for the onchange functions is nothing special but I am unsure how to get the page to load:

    function stopit() {
    alert("Error\nYou tried to change the total value. This form must now reload");
    }

    Any ideas

    K

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Why not just use HTML so that the user cannot edit the result value, like so:
    Code:
    <input type="text" name="result" readonly="readonly" />
    The readonly attribute will let the user copy the text in the box, but he can't alter the value. This also has the pleasant side effect of working even when Javascript is turned off.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    England
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes this would be ideal.
    Unfortunately though, this form is in a lotus notes page and when you add values like readonly and disabled, notes does not stored it in the database...

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    The disabled attribute is the only one that shouldn't be sent when submitting a form. Readonly should be sent over when a form is POSTed, so either Lotus is violating the HTTP spec or you have only tried it with disabled.


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
  •