GriefCode Posted February 15, 2017 Posted February 15, 2017 Hey, I had this issue previously once already. My form within a step is executed on load of the new step: This is my code: $steps = []; $url = \IPS\Http\Url::internal( 'app=sharedstats&module=report&controller=create', 'front' ); [....] /** * STEP 1: Account Connection Selection */ $steps['sharedstats_report_create_account'] = function($data) use ($accounts, $names) { $form = new \IPS\Helpers\Form('', 'continue'); $form->addHeader('Select Battle.net Account'); $form->add( new \IPS\Helpers\Form\Select( 'sharedstats_report_select_account', null, true, ['options' => $accounts])); if ($values = $form->values()) { $data['account'] = $names[$values['sharedstats_report_select_account']]; return $data; } return $form; }; /** * STEP 2: Selet Game */ $steps['sharedstats_report_select_game'] = function ($data) use ($names) { $games = $gameIds = []; $i = 0; $acc = isset($data['account']) ? $data['account'] : $names[0]; foreach ((\IPS\DB::i('stats')->select('*', 'stats_gameplayers', array('name=? AND spoofedrealm=?', $acc['name'], $acc['server']), 'id DESC', \IPS\Settings::i()->report_max_last_games)) as $gameplayer) { try { $game = \IPS\DB::i('stats')->select('*', 'stats_games', array('id=?', $gameplayer['gameid']))->first(); $dotaPlayer = \IPS\DB::i('stats')->select('*', 'stats_dotaplayers', array('newcolour=? and gameid=?', $gameplayer['colour'], $game['id']))->first(); $hero = mb_strtoupper($dotaPlayer['hero']); $gameIds[$i] = $game['id']; $games[] = $game['gamename']; } catch(\UnderflowException $e) {} ++$i; } $form = new \IPS\Helpers\Form('', 'continue'); $form->addHeader('sharedstats_report_select_game'); $form->add(new \IPS\Helpers\Form\Radio('sharedstats_report_select_recent_game', null, true, array('options' => $games))); if ($values = $form->values()) { $index = $values['sharedstats_report_select_recent_game']; $data['gameid'] = $gameIds[$index]; return $data; } return $form; }; What does cause it? Regards
Recommended Posts
Archived
This topic is now archived and is closed to further replies.