Hi again,

I think I figured it out eventually. I had to replace the //get next page to work on lines in verifyjs.php with the ones below. It checks if the page where the next boxgroup is situated is actually in the database, and if not tries to find the next group which is (or allows submitting the form if there are no more pages/boxgroups in the database). Please tell me if you find any errors in this. It works fine so far for me.

 

//function to check if page is missing and finding the next one which is there

function skipmissing($bgid,$fid,$db,$max)

{

$i=$bgid;

while($i<=$max)

{

$sql = "SELECT pid

              FROM boxes

              WHERE bgid = '$i'";

      

       $bggg = $db->GetRow($sql);

       $pid = $bggg['pid'];

       $sql = "SELECT fid

              FROM formpages

              WHERE pid = '$pid' AND fid = '$fid'";

       $bggg = $db->GetRow($sql);

       $exists = $bggg['fid'];

    if($exists!="") {return array($i,$bgid); break;}

else{$i++;}

   }

}

//get next page to work on

$sql = "SELECT max( bid ) as bid FROM formboxes WHERE fid = '$fid'";

       $bggg = $db->GetRow($sql);

       $max_bid = $bggg['bid'];

$sql = "SELECT bgid FROM boxes WHERE bid = '$max_bid'";

       $bggg = $db->GetRow($sql);

       $max = $bggg['bgid'];

 

       foreach($_SESSION['boxgroups'] as $key => $val)

       {

              if ($val['done'] == 0)

              {

                     list($i,$oldbgid) = skipmissing($key,$fid,$db,$max);

//set skipped boxgroups as done

     while($oldbgid<$i)

       {

       $_SESSION['boxgroups'][$oldbgid]['done'] = 1;

      $oldbgid++;

       }

//and then skip to new boxgroup

       $bgid=$i;

       break;

              }

       }

 

Cheers!

 

 

Von: Jansky, Roland [mailto:Roland.Jansky@uibk.ac.at]
Gesendet: Donnerstag, 01. Dezember 2011 07:24
An: quexf-discuss@lists.sourceforge.net
Betreff: [Quexf-discuss] Ignoring missing pages when verifying?

 

Dear all,

anyone has an idea for the following problem?

 

Von: Jansky, Roland
An: 'Adam Zammit'

 

Dear Adam,

I am trying to find a solution to another problem right now: I would like to make a questionnaire with 10 pages. Sometimes not all of these pages are used, but it can’t be told in advance which ones. Problem is now: when the verifier is going through the form to confirm the fields, it will “hang” at the missing page. And won’t let the form finish. Is there any simple solution, so that when verifying, it will just ignore when a page is missing in formpages (leaving the variables on this page empty) and skip to the next? I tried to figure out how to change your code accordingly, but failed.

 

Your help would be much appreciated J

Roland