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

The server responded with an error. The error message is in the JavaScript console.

Discussion in 'XenForo Development Discussions' started by localhost8080, Mar 14, 2015.

  1. localhost8080

    localhost8080 Well-Known Member

    Hi friends of this nice peace of bugware.

    Sometimes I wish I had never moved from phpbb to this stuff. But who cares.

    I do some simple stupid form stuff and send it to my class.

    Like a textbox where a user enters his name and I respond his name back from my class.

    But, instead of displaying the response, I get

    When I look in my console, I see the correct modified stuff from my method in json format but the page content doesn't change except that nice error overlay.


    I have a simple form in my template:

    <form action="/pages/Testpage1" method="get" class="xenForm AutoValidator" data-redirect="on">
        Your Location: <input name="form_location" type="text" value="{$visitor.location}" class="textCtrl autoSize" maxlength="5" size="5" />
        <input type="submit" value="submit your entry" class="button primary" />
    and a callback class method that is being called on form submit:

        public static function getThreads(XenForo_ControllerPublic_Abstract $controllerXenForo_ControllerResponse_Abstract $response)
    $loc = (int)$controller->getInput()->filterSingle('form_location'XenForo_Input::STRING);

    var_dump("YOUR LOC IS: " $loc);
    $threadIds = array();

    $threads $threadModel->getThreadsByIds(
    'join' =>
    XenForo_Model_Thread::FETCH_FORUM |
    'permissionCombinationId' => $visitor['permission_combination_id'],
    'order' => 'post_date',
    'orderDirection' => 'desc'
    $response->params['threads'] = $threads;
    $response->templateName 'thread_list_modified';
    in the js console I see the output of the var_dump from my method...

    some one got a hint what's going wrong here?

    thank you.
    williams1997 likes this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    Remove the var_dump and it should work fine.
  3. localhost8080

    localhost8080 Well-Known Member

    thank you. but if I remove the var_dump, I get an

  4. Chris D

    Chris D XenForo Developer Staff Member

    You probably need to:

    return $response;
    At the end.
  5. localhost8080

    localhost8080 Well-Known Member

    this doesn't help. Still unspecified error. On first page call, content is generated by the same method.

    This problem only occurs if I submit that form...
  6. Chris D

    Chris D XenForo Developer Staff Member

    It's going to be tricky without seeing the rest of your code.
  7. localhost8080

    localhost8080 Well-Known Member

    Okay, thank you. I will try it tomorrow with simple code and give you response.

    Or, I send you my code by pn tomorrow and send you some bottles of best bavarian beer if you fix it. ;-)
  8. Lawrence

    Lawrence Well-Known Member

    From your form action, you are using a Page Node. The callback for your Page Node should be used to generate the data you want displayed on that page (calls the templateName with the form in it).

    Your form action should point to a controller public class to read the form data when submitted, ie:
    <form action="{xen:link 'page/dosomething'}"

    class Your_ControllerPublic_Page extends XenForo_ControllerPublic_Abstract
        public function 
    $loc = (int)$controller->getInput()->filterSingle('form_location'XenForo_Input::STRING);
    // process your input and save it and then return a responseView or a responseRedirect
  9. Nobita.Kun

    Nobita.Kun Well-Known Member

    I think the problem is AutoValidator classes. Just try to remove the class maybe help.
    Lawrence likes this.
  10. Lawrence

    Lawrence Well-Known Member

    I use the autoValidator class for the form I use for my page node and it causes no problems, as it receives the responseRedirect message sent from the public controller:

    <form name="traininghall" id="traininghall" action="{xen:link 'traininghall/next'}" method="post" class="xenForm AutoValidator" data-redirect="on">
            return $this->responseRedirect(
  11. localhost8080

    localhost8080 Well-Known Member

    is there a simple way to xenlink the custom controllerpublic without creating add ons and other hocus pocus?
  12. localhost8080

    localhost8080 Well-Known Member

    Ok. I have got my add on, route prefix, public controller.

    My page node gets data from callback class and contsins a form.

    After submiting the form my variables comes until controller.

    Now, how do i push them to my callback class and rebuild the page node?
  13. localhost8080

    localhost8080 Well-Known Member

    Hello. Someone got a hit to finish this trivial data handling?
  14. localhost8080

    localhost8080 Well-Known Member

    Yeah. Software and customer service made in brittain.

    Now i know why we've got audi, bmw and mercedes benz.
  15. Brogan

    Brogan XenForo Moderator Staff Member

    Do you think that posts of this nature are more or less likely to result in community support?
  16. localhost8080

    localhost8080 Well-Known Member

    no, surely not. but if you pay year by year for two licences and even don't get answers for simple questions like how to handle data from a custom form, I ask you where's the support and why do you call this "customer area"?
  17. Brogan

    Brogan XenForo Moderator Staff Member

    The forum is for community support, which you aren't paying for.

    You pay for ticket support, which will guarantee a response from a XenForo staff member.

    Ticket support however isn't for custom development, styling, modification, etc.

    Bear in mind that all responses on the forum are by people using their spare time of their own accord, for free.
  18. localhost8080

    localhost8080 Well-Known Member

    Okay. Hello again. Is someone able to do this for money? I hired almost three freelancers from ukraine, india and pakistan and they failed... :-(
  19. localhost8080

    localhost8080 Well-Known Member

    got it. thx a lot.
  20. williams1997

    williams1997 Active Member

    i dont understand this ? where do i put them ??

Share This Page