Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Refresh Page from within Vanilla

When an error occurs I want the post.php page to reload and display the error
right now I have this code
$Context->WarningCollector->Add($Context->GetDefinition('WrongDateFormat')); header('Location: '.GetUrl($DiscussionForm->Context->Configuration, 'post.php', '', 'CommentID', $CommentID, '', ''));

First I do not want to track incoming string and track the CommentID or Category ID. I need a simple way to just refresh the page
Second I have added the errors. but when post.php loads the error is not displayed. is there something more that I have to do to get it to display. post.php already has the error placeholders.

Comments

  • WarningCollector gets cleared out when you do the redirect, because the redirect immediately points the browser to a new page load. You could pass a parameter on the redirect and check for the message there... You would be better off allowing this page to load with the message in place. I think ErrorManager might be a better choice... use whatever raises the message when the subject field is left blank. Post (or whisper) the code and i'll have a look.
  • edited May 2007
    If I submit a blank form Vanilla spits out errors, and my errors are also displayed.
    This doesn't happen if there are no Vanilla errors and only my fields are resulting in error.

    there should be a way to tell Vanilla that there are errors other than its own, that need to be displayed and the page reloaded.
  • That's basically the way that Vanilla does it anyways, so there isn't anything wrong with that, just add an 'exit;' after those lines
  • edited May 2007
    How about ajax date validation
    enter date, if wrong it displays error and disables the Save button
    thats one way around this.

    Edit.
    Done :)
    Do date validation during PreSaveDiscussion. If error it displays error. and doesn't save
    Saving the Date is done during PostSaveDiscussion
    Only problem now if the date is wrong, it goes to its default value of blank. rather than reload the wrong one again. which is what it should do.

    Added support for next week and so using strtotime.
    thanks Wallygator
This discussion has been closed.