FormItSaveForm snippet missing?

Hi,

is the FormItSaveForm deprecated in MODX 3, or has something gone wrong in my install?
Can’t find it on FormIt/core/components/formit/elements/snippets at develop · Sterc/FormIt · GitHub
as well (any branch).

I can find the class though - FormIt/Saveform.php at 57f2a4761c2e0538c8bc2c417d40a3247cc93469 · Sterc/FormIt · GitHub

Using MODX 3.0.3-pl w/ PHP 8

Hi @excavator, I haven’t used FormIt with MODX 3 yet, but I think you looked at the wrong branch and also inside the wrong folder: FormIt/Saveform.php at 57f2a4761c2e0538c8bc2c417d40a3247cc93469 · Sterc/FormIt · GitHub

There was a problem with MODX3 and the SaveForm-Hook,
but it seems to have been resolved in the last version:

Some questions:

  • What is actually the problem in your setup? ^^
    • Do you have any error-messages?
    • Doesn’t it save?
    • Or does it save (check in DB), but doesn’t show in the grid of saved forms?
  • What version of FormIt are you using?
  • Have you tried re-installing FormIt?
  • Have you added the hook in the &hooks= parameter of the FormIt-call?
  • If these questions didn’t nudge you to the solution, please provide more info,
    and maybe also show your FormIt-Snippet-Call
1 Like
  • What is actually the problem in your setup? ^^
    • Do you have any error-messages? No, nothing in error log, when I add the hook the form stops working. No success message, no error message.
    • Doesn’t it save? Nowhere, doesn’t even send to an email.
    • Or does it save (check in DB), but doesn’t show in the grid of saved forms?
  • What version of FormIt are you using? 5.0.1
  • Have you tried re-installing FormIt? Yep, and it didn’t help.
  • Have you added the hook in the &hooks= parameter of the FormIt-call? Yes, there’s recaptcha, email and this one in there.
  • If these questions didn’t nudge you to the solution, please provide more info,
    and maybe also show your FormIt-Snippet-Call

I’m also not seeing a FormItSaveForm snippet in the manager. It is there on the MODX 2.X sites.

{'!FormIt' | snippet : [
	'emailFrom' => 'noreply@domain.org',
	'emailFromName' => 'SenderName',
	'emailSubject' => 'Subject Example',
	'emailTo' => 'me@mydomain.com',
	'validate' => 'name:required,email:email:required,genre:required,demo:required,gdpr:required,rules:required',
	'hooks' => 'recaptchav3,email,FormItSaveForm ',
	'validationErrorMessage' => 'A form validation error occurred. Please check the required fields and try again.',
	'successMessage' => 'Thank you for your application. We will get back to you as soon as possible.',
	'submitVar' => 'contactform',
	'emailTpl' => '@FILE email/contact_mail.tpl',
]}
1 Like

Did you try if it works without the space at the end of the string?


This is normal for your version of FormIt.


I tested the FormItSaveForm hook on MODX 3.0.3 with FormIt 5.0.1-pl and PHP 8, and I couldn’t reproduce the issue.

{'!FormIt' | snippet : [
	'hooks' => 'FormItSaveForm',
	'successMessage' => 'Thank you for your application. We will get back to you as soon as possible.'
]}
2 Likes

Looks like it stops working, when the recaptchav3 hook is present.
I’ve also tried using the formFields parameter to eliminate any issues with the field itself saving, but it hasn’t helped. :frowning:

But when you use the “recaptchav3” and the “email” hook without the “FormItSaveForm” hook everything works? So the problem is the combination of the “recaptchav3” and the “FormItSaveForm” hooks?

1 Like

Correct. Using recaptchav3 and email works correctly.
Using just FormItSaveHooks works as well, and the email-formitsavehook combo works as well.

Nothing in server logs, nothing in MODX logs. I’m looking into it a bit further.

EDIT: I’m also not excluding an issue on my side. I’ll try if I can reproduce it on a Modx Cloud instance over the weekend.

1 Like