Welcome Guest, Not a member yet? Register   Sign In
Showing popup alerts from DB result?
#1

I am trying to write a simple CRUD and would like to use alerts (or whatever it is called) to display to the user the result of his actions without have to refresh the page or load a different one with the message.

For instances if the user tries to insert a product that already exists in DB I would like to pop an error message in the screen. Of course I do NOT want to use the regular ugly JS stuff -- instead I'd like to use some bootstrap neat thing such a "toast" (I think this is the name).

I spent a couple hours trying to find some example about how to do this but didn't get success (several stuff for CI3 but not for CI4). Any clue please?

Thanks!
Recovering the wasted time...
Reply
#2

@YanKleber,

Are you using a bootstrap 3 or 4 admin theme?
Reply
#3

(This post was last modified: 05-01-2020, 04:09 PM by YanKleber.)

I am using Bootstrap 4 directly into the application importing it into the files with <script src="etc" />. I don't know what is admin theme.

PS: I am learning Bootstrap and Codeigniter at the same time...
Recovering the wasted time...
Reply
#4

Sounds to me like you need ajax which is another concept than just codeigniter and bootstrap's alert functionality.
I´ll suggest you start with accepting the page to reload. When you get your bootstrap alerts to work that way you can then start learning it the Ajax way.
Good luck!
Reply
#5

(05-01-2020, 04:55 PM)muuucho Wrote: Sounds to me like you need ajax which is another concept than just codeigniter and bootstrap's alert functionality.
I´ll suggest you start with accepting the page to reload. When you get your bootstrap alerts to work that way you can then start learning it the Ajax way.
Good luck!

You are absolutely right. I have worked with AJAX before but doing everything directly in JS from scratch.

I thought that with all bells and whistles of CI and BS there was already some kind of "black magic" built into the framework able to do the job without the need of get my hands dirty.

Wink
Recovering the wasted time...
Reply
#6

@YanKleber,

Here are several examples of a Bootstrap Admin themes that you can use that has that ability built in.
https://getstisla.com/
http://themekit.lavalite.org/
Reply
#7

(05-02-2020, 07:58 AM)php_rocs Wrote: @YanKleber,

Here are several examples of a Bootstrap Admin themes that you can use that has that ability built in.
https://getstisla.com/
http://themekit.lavalite.org/

Cool, thank you! For now I will stick with CI and BS only. Better to avoid add one more variable to my equation at this time!
Recovering the wasted time...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB