Formit Beginners Tutorial?

No probs. I think the code missing might be due to using single backticks, which modx tags also uses so it opens and closes the highlighting. Try surrounding the start and end of the code with three backticks ``` and hopefully that’ll sort out dropping code in here in the future :slight_smile:

OK,

next question.

What I’m trying to do is create a subscription form, and I’ve already got the first part working.
What i now want to do is
1: send a success email to the new subscriber
2: save the details to a db

Any pointers on the best way to do those?

You can do it with your own custom hooks, or you can use one of the pre-made ones:

https://docs.modx.com/extras/revo/formit/formit.hooks/formit.hooks.formitautoresponder
https://docs.modx.com/extras/revo/formit/formit.hooks/formit.hooks.formitsaveform

Yeah,

been trying the autoresponder, can’t get it to work. Must be missing something in my call

[[!FormIt?
&hooks=`email,redirect,FormItAutoResponder`
&emailTpl=`sentEmailTpl`
&emailSubject=`[[++site_name]] Message from Me`	
&emailTo=`my@email`
&redirectTo=`25`           
&validate=`email:email:required` 
&fiarTpl=`subResponseTpl`
&fiarSubject=`Thanks for Subscribing`
&fiarToField=`fi.email`
&fiarFromName=`Me`

]]

Try putting it before the redirect hook.
e.g.
&hooks=`email,FormItAutoResponder,redirect`

Made no difference.

Maybe the &fiarToField is wrong I’ve tried both email and fi.email.

The &fiarTpl=subResponseTpl is pretty simple

<p>[[+fi.firstname]], </p>
<p>Thanks for signing up.</p>

I can confirm that &fiarToField should be the ‘name’ attribute of the field the user is entering their email into, not the placeholder value.

Then in the TPL you use the placeholders as you have.

Based on the call above, are you getting your emailTo email correctly and it’s just the fiar one that’s not working?

Have you checked this site is able to send email full stop? There’s a QuickEmail extra to test that easily if you haven’t do so some way yet.
https://docs.modx.com/extras/revo/quickemail

It can send emails because it is sending me the first part of the call and using the correct template for that. That is the form works on the site as far as submission ad redirect to success page and I get the first email.

It’s just the second half with the autoresponder part that’s not firing for some reason.

The email names in the form code are as follows
<input type="text" class="form-control" placeholder="Email Name..." name="email" id="email" value="[[!+fi.email]]">

As I said, I’ve tried both email and fi.email so not sure what’s broken.

How are you sending the emails? Is it a channel where you can see logs to see if a message is being generated vs not creating one at all?

Also, I believe @muzzstick was right - ‘FormItAutoResponder’ it will need to be before ‘redirect’ in the hooks order.

Josh,

not sure about the question.

The emails are being sent thru Modx.

There’s nothing in the modx error logs to show a problem.

I’ve also checked in cpanel and all i can see is the first email being sent, but there’s nothing for the autoresponder.

So my hunch is that it is simply not being generated. So I’m thinking there’s a missed problem in the call or the template somewhere.

And yes Formitautoresponder is before redirect

[[!FormIt?
	&hooks=`email,FormItAutoResponder,redirect`
	&emailTpl=`sentEmailTpl`
	&emailSubject=`[[++site_name]] Message from Me`	
	&emailTo=`my@email address`
	&redirectTo=`25`           
	&validate=`email:email:required` 
	&fiarTpl=`subResponseTpl`
	&fiarSubject=`Thanks for Subscribing`
	&fiarToField=`email`
	&fiarFromName=`Ampli`
]]

You can see the form in action here https://ampli.buzz/signuptest

Use the form in the middle of the page,
not the modal in the top menu bar.

Arrgh. i’m an idiot. Made a silly mistake.

More soon.

Would you mind creating new issues in new threads? It’ll help new users find answers to questions easily rather than one massive thread with loads of different issues and answers. Also don’t forget to mark answers as ‘solved’

I’ll start a new thread,https://community.modx.com/t/weird-formit-issues-call-changes-not-being-processed/472

but there’s no option to mark this question as solved or best answer in this thread.

I think there should be a check mark box at the bottom of users posts.

Not on all posts or categories I’ve been told, and certainly not on this one.

Already had this discussion at Show "Solved-Icon" on the forums main page

So as long as no-one else comments on this thread it should close itself in two days.

Hey,

I moved both topics into the support category. I’m going to make an Extras subcategory here, but you should be able to do what you want now.

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.