When the form reads values from a source, and is being reloaded due to 
an entry error, the user values are over-ridden by the values in the 
source file. Thus, select lists return to their original source file 
values, rather than retaining the values selected by the user.

This is the fix for that:

Move this block:
   if (@$args['request']) {
     $req = array_merge($_GET, $_POST);
     foreach($req as $k => $v){
       if (!isset($InputValues[$k]))
         $InputValues[$k] = htmlspecialchars(stripmagic($v), ENT_NOQUOTES);
     }
   }


Below the "if ($source) {" block.

Change the block to read override the source values (isset rather than 
!isset):
   if (@$args['request']) {
     $req = array_merge($_GET, $_POST);
     foreach($req as $k => $v){
       if (isset($InputValues[$k]))
         $InputValues[$k] = htmlspecialchars(stripmagic($v), ENT_NOQUOTES);
     }
   }


Patch file below.

Left file: Original forms.php
Right file: Modified forms.php
165,170c165
<   if (@$args['request']) {
<     $req = array_merge($_GET, $_POST);
<     foreach($req as $k => $v)
<       if (!isset($InputValues[$k]))
<         $InputValues[$k] = htmlspecialchars(stripmagic($v), ENT_NOQUOTES);
<   }
---
 >
181a177,183
 >     }
 >   }
 >   if (@$args['request']) {
 >     $req = array_merge($_GET, $_POST);
 >     foreach($req as $k => $v){
 >       if (isset($InputValues[$k]))
 >         $InputValues[$k] = htmlspecialchars(stripmagic($v), 
ENT_NOQUOTES);

  ~ ~ Dave

_______________________________________________
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Reply via email to