delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

, blank field), all of the data in the form gets wiped out.
Has anyone seen this before and suggest a workaround?


I'm using an HTML form to post data to be processed by a PHP script. However it appears that if data is submitted from the form, and it does not get through the inline JavaScript edits because of an error (e.g., blank field), all of the data in the form gets wiped out.
Has anyone seen this before and suggest a workaround?

TOP

have you looked at "cookies"

TOP

Not really - it seems like it's not appropriate for storing a number of fields that add up to several thousands of bytes of data.
I'm asking because I ran acrross a discussion (not necessarily on DevShed) on how to do this.

TOP

Check for the valid posted data (PHP) and write it back to the form (JavaScript).
E.g:
PHP Code:
[url=#top]
[/url]Original
                - PHP Code
echo "
        <script type='text/javascript'>
        onload=function()
        {
                //assume the first element of the first form with a name of text
                document.forms[0].elements[0].value={$_POST['text']};
        }
        </script>
        ";
}
  1. [url=http://www.php.net/echo]
  2. echo
  3. [/url]
  4. "
  5.     <script type='text/javascript'>
  6.     onload=function()
  7.     {
  8.         //assume the first element of the first form with a name of text
  9.         document.forms[0].elements[0].value={$_POST['text']};
  10.     }
  11.     </script>
  12.     "
  13. ;
  14. }
Copy Code
Bizzare problem, slightly, because if you're using JavaScript, you'll usually validate (blank fields, improper character data etc) before any form submissions.
Hope this helps, mjcondon.

TOP

abstract:

, blank field), all of the data in the form gets wiped out.
Has anyone seen this before and suggest a workaround?


Perhaps a somewhat simpler solution, Kravvitz.  

TOP

Back Forum