ArashDev Posted October 18, 2023 Posted October 18, 2023 I have created an application, and everything works fine, but after clicking the save button, I don't see the 'Saved' flash message. my codes: protected function manage() { $form = new \IPS\Helpers\Form; $form->add( new \IPS\Helpers\Form\Number( 'createtopic_setting_left', \IPS\Settings::i()->createtopic_setting_left ) ); if ($values = $form->values(true)) { $form->saveAsSettings($values); } \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menutab__test'); \IPS\Output::i()->output = $form; } whats wrong with that? thanks in advance
Management terabyte Posted October 19, 2023 Management Posted October 19, 2023 For the message to appear you need to add a redirect inside the IF check after the settings are saved. \IPS\Output::i()->redirect( YOUR_PAGE_REDIRECT_URL, 'saved' ); Here's the full code: protected function manage() { $form = new \IPS\Helpers\Form; $form->add( new \IPS\Helpers\Form\Number( 'createtopic_setting_left', \IPS\Settings::i()->createtopic_setting_left ) ); if ($values = $form->values(true)) { $form->saveAsSettings($values); # Redirect showing a message \IPS\Output::i()->redirect( YOUR_PAGE_REDIRECT_URL, 'saved' ); } \IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menutab__test'); \IPS\Output::i()->output = $form; } Replace the redirect URL, and you can change the language string used for the message in the second parameter. The example above uses the generic Saved language string. ArashDev 1 Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! >
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now