This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

zs60815
zs60815

Hi,

Until now I had 'debug' => true setting in app.php and I was happy how easy was to set up Flash messages. Now I turned that to false, and Flash messages, Loading indicator, Form validation messages stopped working. What am I missing here? Ajax still works as expected....

Last updated

zs60815
zs60815

Nevermind, I put the the {% framework extras %} in wrong place accidentally. I don't even know how did it work at all with debug enabled.

zs60815
zs60815

However, I still have a question. How to modify the error messages? So users won't the the full error when not needed?

zs60815
zs60815

If someone is having similar issue, this helped me: https://octobercms.com/docs/ajax/javascript-api

Added script:

$(document).on('ajaxSetup', function(event, context) {
// Enable AJAX handling of Flash messages on all AJAX requests
context.options.flash = true

// Enable the StripeLoadIndicator on all AJAX requests
context.options.loading = $.oc.stripeLoadIndicator

// Handle Error Messages by triggering a flashMsg of type error
context.options.handleErrorMessage = function(message) {
    $.oc.flashMsg({ text: message, class: 'error' })
}

// Handle Flash Messages by triggering a flashMsg of the message type
context.options.handleFlashMessage = function(message, type) {
    $.oc.flashMsg({ text: message, class: type })
}
})

And handled message from there. Basically I just wanted to show "An error occurred, please try again later!" instead the full error.

However I'm not sure how can I make that message translatable.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.