#11 new
ankles

Problem with steps being skipped

Reported by ankles | August 6th, 2013 @ 04:55 AM

Hello,

I'm having a problem with steps being skipped. Here's the sequence of events I noticed during testing:

1) I navigate through all the steps but I do not actually click on 'Submit'.
2) I then use the back button to return to the 'Index' view.
3) Without changing anything, I click on the continue button to go to the next step, which I'm expecting to be 'accountInfo' but for some reason it skips all interim steps and takes me to 'query'.

After a bit of investigation I noticed the post variables contained the initial values selected and the _processAccountInfo() function was never actually called.

I tried using the _prepareIndex() function to clear down the post variables but the steps were still skipped.

My controller is setup as follows:

function beforeFilter() {
    parent::beforeFilter(); 
    $this->Wizard->steps = array(
    'index', 
    'accountInfo', array(
            'no' => array('query'),                  
            'prepay' => array('prepayStep', 'query'), 
        'billpay' => array('billpayStep', 'query'), 
        'business' => array('businessStep', 'query')
    )
    );
        
   $this->Wizard->completeUrl = '/success';
        
}
function _processIndex() {
        
        CakeLog::write('activity', 'In the _processIndex() function.');
        
        if(!empty($this->data)) {
            $this->CustomerQuery->set($this->data);
            $fields_to_validate = array();

            // Common fields
            $fields_to_validate[] = "fname";
            $fields_to_validate[] = "lname";
            $fields_to_validate[] = "email";
            
            if($this->CustomerQuery->validates(array('fieldList' => $fields_to_validate))) {
                return true;
            }else{
                $this->set('errors', $this->CustomerQuery->validationErrors);
                $this->Session->setFlash('Errors!', 'fail');
            }
        }
        
    }
    
    function _processAccountInfo() {
        
        CakeLog::write('activity', 'In the _processAccountInfo() function.');
        
        if(!empty($this->data)) {
            $this->CustomerQuery->set($this->data);
            $fields_to_validate = array();

            // Common fields
            $fields_to_validate[] = "is_customer";
            //$fields_to_validate[] = "cust_type";
            
            // Determine what options were selected by the user and display the appropriate page.
            if($this->CustomerQuery->validates(array('fieldList' => $fields_to_validate))) {
                if($this->data['CustomerQuery']['is_customer'] == 'No') {
                    CakeLog::write('activity', 'Here...1');
                    $this->Wizard->branch('no');
                } else {
                    if($this->data['CustomerQuery']['is_customer'] == 'Yes') {
                        switch($this->data['CustomerQuery']['cust_type']){
                            case 'prepay':
                                CakeLog::write('activity', 'Here...Prepay');
                                $this->Wizard->branch('prepay');
                                break;
            
                            case 'billpay':
                                CakeLog::write('activity', 'Here...Billpay');
                                $this->Wizard->branch('billpay');
                                break;
            
                            case 'business':
                                CakeLog::write('activity', 'Here...Business');
                                $this->Wizard->branch('business');
                                break;
            
                            default:
                                CakeLog::write('activity', 'Here...Break');
                                break;
                        }
                    }
                }
                return true;
            }else{
                $this->set('errors', $this->CustomerQuery->validationErrors);
                $this->Session->setFlash('Errors!', 'fail');
                return false;
            }
        }
        
    }

Any help appreciated.

Regards...

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Pages