1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Development Discussions' started by cclaerhout, Mar 11, 2012.

  1. cclaerhout

    cclaerhout 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 :)
  2. James

    James 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.
  3. cclaerhout

    cclaerhout Well-Known Member

    Watched... at least 5 times but too confused especially the beginning.
  4. cclaerhout

    cclaerhout 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.
  5. localhost8080

    localhost8080 Well-Known Member

    did you find an answer for this?
  6. cclaerhout

    cclaerhout Well-Known Member

Share This Page