Form data inside notification message

I have a serverconnect form that must display a notification onsucces.
It works, but as soon as I add one or more dynamic form input field data inside the notification message it produces an error and the notification is not shown.

 dmx-on:success="not_forminsert.success(&quot;Hartelijk dank {{geb_voornaam.value}} {{geb_achternaam.value}}  voor uw aanmelding op de nieuwsbrief. <br>U kunt zich ten alle tijden via een link op de nieuwsbrief weer uitschrijven.&quot;)" 

TypeError: undefined is not a function (near ‘…not_forminsert.success…’)

That does not look correct to me to be honest.

dmx-on:success="not_forminsert.success('Hartelijk dank '+geb_voornaam.value+' '+geb_achternaam.value+' voor uw aanmelding op de nieuwsbrief. <br>U kunt zich ten alle tijden via een link op de nieuwsbrief weer uitschrijven.')"

So basically each time you use LITERAL text then it needs to be wrapped in single quotes, even just a single LITERAL ’ ’ SPACE needs the single quotes.
When you want to break out of LITERAL to DYNAMIC DATA then you drop the single quotes and insert a + to add DYNAMIC DATA to the LITERAL data, and if you want more LITERAL text after the DYNAMIC, then you add another + with text after the plus in single quotes.

Hope that makes sense and works, let me know.

1 Like

Thank you Paul, that works. I knew that was the right syntax, but since I used the the dialog from the notification plugin to add dynamic data I assumed Wappler had some magic to make it right.
Conclusion: @Teodor, @George inserting dynamic data in normal strings for notifications perhaps needs some formatting work.

1 Like

@oscreative not sure what do you mean that it needs some formatting, but the static content must be wrapped in single quotes ‘static text’ while the dynamic data is just the expression without any quotes.
This has already been explained in the documentation wherever static and dynamic data is used.

Well… even if I place static strings inside quotes and then choose a dynamic data, Wappler places that inside {{ }} like:

'my static content .'+{{geb_mail.value}}

and that give an error in the browser, while:

my static content .'+geb_mail.value

so without the {{ }} works. It should be clear when or when not to use {{ }} I think.

Most probably you have not selected “Expression” here and that is why it inserted them wrapped with {{ }}

If you select “Expression”, as this is an expression, then it is just fine.

Thank you for making that clear. I used ‘Template’ and not ‘Expression’.
With Expression all is well.