We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32380
    • 137 Posts
    Hi there i used the following
    <a href="javascript: window.history.go(-1)">Edit</a> 
    

    and change the -1 to wheat ever you like?

    hope this helps!!
      • 29313
      • 4 Posts
      Thanks for your suggestion, wiggy! Unfortunately this didn’t work, Internet Explorer still shows "Warning: Page has Expired" message.
        • 7455
        • 2,204 Posts
        I have a strange problem i use the onbeformailsend event to place all values in the databse like this:
        	<?php	// Loop through each column, and insert it if present in the form
        		foreach ( $tblColumns as $tblCol ){
        			if (isset ( $_SESSION ['krediet'] [$tblCol] )){
        				$dbTable [$tblCol] = $_SESSION ['krediet'] [$tblCol];
        			    }
                        }
                        $dbTable [datum] = time ();
        		// Run the db insert query
        		$dbQuery = $modx->db->insert ( $dbTable, 'krediet_aanvragen' );
                    
                        // set alle velden weer in $fields zodat we een report kunnen maken met alle velden.
                       $fields = $dbTable;
                       $fields['test'] = "test123";
                       $fields['formid'] = "watleuk";
        return true;
        


        the fields are in the db BUT the fields I changed and added in this case:
        $fields = $dbTable;
        $fields[’test’] = "test123";
        $fields[’formid’] = "newid"
        are not in my report
        formid has the original formid string and not the "newid" string i put in here.
        looks like $fields is not renewed in this case.

        do I miss something?

          follow me on twitter: @dimmy01
          • 21722
          • 8 Posts
          Am I right in thinking this is only a solution to split a form between multiple chunks, rather than actual pages?

          I want to have a subscribe link on my home page with just an email field and pass this through to subsequent real pages..
            • 31640
            • 100 Posts
            somebody tested this on modx 1.0.2 and eform 1.4.4.6 huh

            Because the basic exemple isn’t working for me.
            It gives a blank screen when i click on the submit button

            Need to get this working for my next project sad

            Somebody can help me?...
              • 18174
              • 116 Posts
              For this great & powerful snippet, I always missed the code to retain the field values when hopping between the different form pages.
              Heres is my code to provide this:
              if(!function_exists("elipsTriaOnbeforeMergeFunction")){
              	//Display different form depending on session
              	function elipsTriaOnbeforeMergeFunction( &$fields ){
              		global $modx,$formats;
              		foreach ($formats as $key=>$val) 
              			if (empty($_POST[$key]) ) 	//doesn't work with $fields[$key]
              				if (isset($_SESSION['mySession'][$key])) 
              					switch ($formats[$key][2]) {	//data type
              					case 'integer': case 'float':	//strip formatting
              						$fields[$key] = (float) str_replace("'",'',$_SESSION['mySession'][$key]);
              						break;
              					default:
              						$fields[$key] = $_SESSION['mySession'][$key];
              					}
              				else
              //set standard values
              					switch ($key){
              					case 'begindate': 
              						$fields[$key] = strftime("%d.%m.%Y",time());
              						break;
              					}
              	}
              }

              If someone has a straighter solution, let me know.
              I also have a solution for a real "back" button, but that’s another story.
              regards manu

              PS: eform works on 1.0.4 without problems.
                • 18174
                • 116 Posts
                It’s already awhile ago but somebody asked me for the backButton Solution.
                Here it is. It’s an extract of quite a big solution so I’m not absolutely sure if it is complete. But I will sure give a hand if somebody has questions.
                if(!function_exists("beforeMailSentFunction")){
                	//store results in session and advance form
                	function beforeMailSentFunction(&$fields){
                		global $modx;
                		
                		if (!is_array($_SESSION['mySession'])) $_SESSION['mySession'] = array();
                			
                //save values in session
                		$_SESSION['mySession'] = array_merge ($_SESSION['mySession'],$fields);
                						
                		$step = isset($fields['formStep'])?$fields['formStep']:1;
                		
                //	don't use $fields['backbutton'] because its set anyway by eForm
                		$backbutton = $_POST['backbutton']? -1:1;
                		$step = max($step + $backbutton,1); //prepare next step
                		$_SESSION['mySession']['formStep'] = $step; //prepare next step
                		if ($step > 2){ //last form	
                
                			// clear formstep 
                			unset($_SESSION['mySession']['formStep']);   
                							
                			return true; //
                		}
                
                		// except for the last step we clear the $_POST array
                		// and bypass eform and re-open the page with the next form
                		//unset($_POST); - doesn't work in php 4.3.xx 
                		$_POST = array();
                		$modx->sendForward($modx->documentIdentifier);
                		return false; //
                	}
                }

                I hope this helps.
                Good luck and regards
                manu