SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    birmingham, uk
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Validating form forces new page to open

    Hi All,

    I have a page consisting of three frames the left hand side frame contains a menu(buttons) when I click upon the change password button it opens up the page in the center frame once the user has entred the details the page is sent to a php page if the password could not be changed redirects the user (through javascript)back.

    The problem I am having is when I enter validation within javascript for the html page is that once the page gets redirected back when I click on the buttons the page do not appear within the center frame but rather a new window gets opened does anyone know why?

    here is the code


    ****************changepassword.html******************8
    <script>function validate()
    {
    name=document.myform.username.value;//when entering this line the pages open in new window
    alert("hello");
    }</script>
    </head>

    <body>
    <h1>Hello</h1>

    <form name="myform" action="checkpassword.php" method="post" onSubmit="return validate();">
    <table>
    <tr><td><input type="text" name="username"></td>

    </tr>
    <tr><TD><input type="password" name="oldpwd"></TD></tr>
    <TR><td><input type="password" name="newpwd"></td></TR>
    <TR><TD><input type="password" name="confirmpwd"></TD></TR>
    </table>

    <input type="submit" name="change password" value="change password">
    </form>

    Any help would be much appreciated....
    Humaira

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "Alec, I'd like to guy a period for $100, please."


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
  •