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

Trouble with form return message

Discussion in 'XenForo Development Discussions' started by account8226, Mar 24, 2013.

  1. account8226

    account8226 Guest


    I am having trouble with my forms, I have an action, and data-fieldValidatorUrl, with data-redirect on off.

    When I submit my form :

    If there is an error, it's working fine, a nice XenForo's error popup is showing up with the following code :
    $this->responseError(new XenForo_Phrase('error'));
    But when everything goes fine, I would like the page to refresh, but it's actually returning a javascript error, here is the result with firebug :
    Here is the final return code :
    $redirectUrl XenForo_Link::buildPublicLink('my_link');

    How can I return a simple message as a popup for example ? That would say everything was fine, do I have to use javascript ?

  2. Chris D

    Chris D XenForo Developer Staff Member

    You're doing it the right way.

    On your form element in the template ensure you have "AutoValidator" as one of the class names and have data-redirect="on" as an attribute on the form too.
  3. account8226

    account8226 Guest

    Hey thanks for the reply,

    My problem is that I have everything like you said, like the AutoValidator or data redirect tag, but it's throwing a JS error :

    The JS error message is above on post #1.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Is that all that's in the console? Doesn't look like an error to me.

    Just a thought: Make sure you've not got anything that could modify the output of the form action...

    e.g. If you have anything like echo, or var_dump or Zend_Debug::dump then it may very well generate an error (as it breaks the json output).

    Aside from that, a javascript error message can come up due to some other reason. Check closely for syntax errors etc.
  5. account8226

    account8226 Guest

    Check out this :

    It it's the Javascript Console (error).

    Don't you think that ?> is strange at the begining ?
  6. Chris D

    Chris D XenForo Developer Staff Member

    hm actually, yeah that doesn't quite look correct.

    As I say, you've probably got a boo boo in your code - whatever code is running when the form is submitted.

    Possibly even a missing close bracket }
    account8226 likes this.
  7. account8226

    account8226 Guest

    Lol ;)



    Thanks for the help Chris :)

Share This Page