XenForo Template Page - Form - Handle post datas - Display result


Well-known member
After having watched several times the "Have you seen... ?" videos about Ajax & XenForo, I still don't understand how to handle very easily post datas from a form then display them in the page.

Could someone explain me how to do this very simple example:

I've got my template Page associated to a class and public static function which make it fetch a defined template.

First step
On this template, I want to create a form to enter a number, then once I press the submit button the post data is sent to php callback which multiply the number by 2.

With a traditional html/php pages, I can do it this way
<form id="fieldForm" action="myfile.php" method="post">
I would like to know how to do it with a XenForo callback being sure the sent data has been verified and secured. There is for example a special function to do this with Wordpress.

Second step
Once my number has been multiplied by 2, I would like to display the PHP output (callback I guess for XF) inside the same page.

With a traditional/php pages, I can use the nice Jquery addon ajaxForm, which will do almost all the work for me.

If someone could write this kind of guide for dummies, it would be really nice :)


Well-known member
Have you watched the XenForo AJAX Tutorial step 3? It creates a username changer and does it all via AJAX. It's useful.


Well-known member
Well I did the classical way with a php file and Jquery addon... But could someone tell my at least how to link a form to a callback instead of using a php file.