XF 2.1 Error reply creates another overlay over an existing one

asprin

Active member
I'm submitting a form via Ajax by keeping ajax="true" on the <xf:form> tag. This form is already being shown as an overlay.

So when I'm processing the form data and want to report back an error, the output is as follows:
1580662160274.png

Is there a way I can put the error message in the overlay that called the ajax action? The code is as follows:

HTML:
<xf:form action="{{ link('fc/save-event') }}" class="block" ajax="true">
    .
    .
    .
    .
    <xf:submitrow icon="save" submit="Create" />
</xf:form>

PHP:
public function actionSaveEvent()
{
    if ($this->isPost())
    {
        $category = $this->filter('e_category', 'int');
        .
        .
        .
       
        if(<something went wrong>)
        {
            return $this->error('Unfortunately the thing you are looking for could not be found.', 400); // <--- Can something be done to this?  
        }
        else
        {
            $this->view('FC:CreateEventAjax', 'post_event_create', $viewParams);
        }
    }
}
 
Top Bottom