cappuccino Posted September 11, 2022 Share Posted September 11, 2022 Hello How can I put out the value from a formfield in the Sucess Message in FormBuilder by a Hook? For example: The value from the formfield "message" = "Vielen Dank". The SucessMessage should be "Vielen Dank". The value from the formfield "message" = "Thank you". The SucessMessage should be "Thank you". I hope you understand my request ;-). Thank you in advance! Link to comment Share on other sites More sharing options...
johndoe Posted September 12, 2022 Share Posted September 12, 2022 This is what I've saved from FB subforum Quote In site/ready.php I add this code... $forms->addHookAfter('FormBuilderProcessor::formSubmitSuccess', function($event) { $form = $event->object; if ($form->formName == 'YOUR-FORM-NAME-HERE' && $form->isSubmitted()) { $values = $form->getValues(); array_walk($values, function(&$i){ $i = htmlentities($i, ENT_QUOTES, 'UTF-8', false); }); $form->successMessage = wirePopulateStringTags($form->successMessage, $values); } }); ... changing 'YOUR-FORM-NAME-HERE' for the actual name of your form. I can now include submitted values in my success messages. Like this; Thank you, {name}. A confirmation email has been sent to {email}. 1 Link to comment Share on other sites More sharing options...
cappuccino Posted September 14, 2022 Author Share Posted September 14, 2022 Perfect, thank you very much!!! Link to comment Share on other sites More sharing options...
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