Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 4, 20177 yr Hello, Widget settings validation doesn't work. Code public function configuration( &$form=null ) { if ($form === null) { $form = new \IPS\Helpers\Form; } $form->add( new \IPS\Helpers\Form\Text( 'custom_validate', isset($this->configuration['custom_validate']) ? $this->configuration['custom_validate'] : null, false, array(), function($val) { if ($val == 'bad') { throw new \InvalidArgumentException('form_bad_value'); } } ) ); $form->add( new \IPS\Helpers\Form\Text( 'required_field', isset($this->configuration['required_field']) ? $this->configuration['required_field'] : null, true, array() ) ); return $form; } I changed in applications/core/modules/front/system/widgets.php from \IPS\Output::i()->sendOutput( $widget->configuration()->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'widgets', 'core' ) ), 'formTemplate' ), $widget ) ); to \IPS\Output::i()->output = $widget->configuration()->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'widgets', 'core' ) ), 'formTemplate' ), $widget ); Result
April 4, 20177 yr Thank you for bringing this to our attention. I've logged an internal bug report and we will take a look.
Archived
This topic is now archived and is closed to further replies.