SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tmp data in form lost when page is reload using javascript...how to solve?

    HTML Code:
    function reload(form)
    {
    var val=form.location.options[form.location.options.selectedIndex].value;
    self.location='page.php?location=' + val ;
    }
    hi,i have a form enable user to register,preview,modify and save their info.

    user can navigate to modify and preview the changes with all the pre-entered data shown accordingly in the textfield. However, when user try to change the location(in a select menu),the form will reload so another select menu(state) will display the relevent info.

    The problem occurs here. As the form reload, all the tmp data lost even the data in session.

    why this happens? do you have any idea to fix it?

    is my reload function correct?

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function reload(form)

    should this form be the name of the form that wish to be reload or...?

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function reload()
    {
    var form = document.getElementById("form_id");
    var val=form.location.options[form.location.options.selectedIndex].value;
    self.location='page.php?location=' + val ;
    }
    Try this.

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Quote Originally Posted by dwees View Post
    Code:
    function reload()
    {
    var form = document.getElementById("1");
    var val=form.location.options[form.location.options.selectedIndex].value;
    self.location='page.php?location=' + val ;
    }
    Try this.
    hi, dwees...
    thanks for your suggestion...
    i've tried on your code...

    mmm.... the tmp data is lost after the reload still...

    in the location menu, i put onchange="reload()"
    in the form it is like below...

    HTML Code:
    <form method="post" id="1" name="f1" action="<?php echo $me ?>" onSubmit="return validate_form1()">
    anything wrong?
    newbie...really need your guidance......


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
  •