Jump to content

Form confirmation message via AJAX


nystrategi
 Share

Recommended Posts

Hi,

I'm about to start developing a website in Processwire but did a bit of research and could'nt find any way to create a form with confirmation message loaded by AJAX when a form is submitted + validated. Is that possible?

I think of something similar to Contact Form 7 for WP (when the visitor submits the form it should get validated and if every field validates and email gets sent the visitor gets a message like "Thank you for your message!" without page reload). Is that possible to do this in Processwire or anything thats on the Feature list?

From what i can understand theres three modules (Form builder, Form Template Processor and Mailer and Simple Contact Form) that can create forms and also a API-function to call and create the form manually.

Is there any of the above which supports ajax submit with "Thank you"-message on the same page without reloading the page on submit? Seems pretty basic, but maybe i've missed something.

Thank you!

Link to comment
Share on other sites

Hi nystrategi and welcome to the PW forum!!

Yes, it's completely possible, and not a problem at all; PW fully supports ajax, and any number of methods for creating forms, and processing them any way you need.

You can create a form processing template and have it return your ajax validation messages, or use a php file in the root that bootstraps PW and then returns the ajax messages, success or validation etc.

Search the forums/docs for ajax, as well as forms; later if i have a chance i will post some links to the most relevant form topics.

Link to comment
Share on other sites

FormBuilder is a Commercial Module created by the Ryan Cramer (ProcessWire's Creator).  The attached link gives more information about this great module.

https://processwire.com/talk/store/product/2-form-builder-single/

The other modules you mentioned are freely available to use or you can create your own form capability using ProcessWire and It's API.

Link to comment
Share on other sites

Hi nystrategi and welcome to the PW forum!!

Yes, it's completely possible, and not a problem at all; PW fully supports ajax, and any number of methods for creating forms, and processing them any way you need.

You can create a form processing template and have it return your ajax validation messages, or use a php file in the root that bootstraps PW and then returns the ajax messages, success or validation etc.

Search the forums/docs for ajax, as well as forms; later if i have a chance i will post some links to the most relevant form topics.

Thank you Macrura!

I'm really looking forward for some links to relevant form topics that can lead me in the right direction. I tried searching for "forms" "ajax form" and "ajax" but could'nt find any guidance or clues.

Sounds good that its possible to create a form processing template and return messages through a separate php-file, may i ask you how i bootstrap PW into that file? I'll try implementing this but it's great news that it should be possible!

Link to comment
Share on other sites

FormBuilder is a Commercial Module created by the Ryan Cramer (ProcessWire's Creator).  The attached link gives more information about this great module.

https://processwire.com/talk/store/product/2-form-builder-single/

The other modules you mentioned are freely available to use or you can create your own form capability using ProcessWire and It's API.

Thanks for your answer cstevensjr!

I looked at Form Builders official product description but could'nt find anything about ajax submitting the forms created by Form Builder and also hard to try it out without buying it. Do you know whether or not it supports ajax submit with email confirmation showing on the same page as the form is located without page reload?

Link to comment
Share on other sites

I believe it does submit the form without the page refreshing (if that is what you are talking about).

Anyway, the product has a stated guarantee,  so you shouldn't have a problem testing it out.

Satisfaction Guarantee
If you purchase a copy of Form Builder and find it doesn't meet your needs and you won't be able to use it, you may get a full refund within 7 days of your purchase, no questions asked.

Link to comment
Share on other sites

Like all the mentioned modules you named above FormBuilder doesn't submit things via ajax out of the box. In ProcessWire modules try to stay out of the way of their users as much as possible. This means you're free to build the ajax implementation of submitting any form by yourself and just like you need it. The reason you didn't find much about ajax submission in the forum is most likely because processwire isn't enforcing any special way of handling ajax. You could simply try out any basic ajax tutorial you can find on the internet and there will be a way to make it work with this cms. If you handle the ajax part, then you can easily use any of the mentioned modules to do the rest.

Link to comment
Share on other sites

Some possible topics:

https://processwire.com/talk/topic/2089-create-simple-forms-using-api/

https://processwire.com/talk/topic/126-anybody-did-user-registrationlogin/?hl=%2Bjquery+%2Bvalidate#entry4812

i think i learned most i needed to know about setting up api forms from these topics, but you will also need to reference the cheatsheet.

try jumping in and experimenting, that's the best way to learn; once you have a form processing page, the rest is going to be mostly handled by javascript/jquery and whatever library you are using (e.g. Validate, Ajax Forms etc..)

In terms of formbuilder, you can make it work with Ajax, but also consider that it can run in an iframe, which means no page reload; this works very well for the large majority of situations, at least in my experience; I would definitely give a strong recommendation to Formbuilder if you need more than 1-2 forms on your site. It is really great!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...