Welcome Guest, Not a member yet? Register   Sign In
Display a 'modal popup' anywhere in the system
#1

Hello everyone this is my first post.
I am new to CodeIgniter and I have a question.
I was wondering if there is a way for me to load a div (modal popup) in any view of my project.
For example, I am performing a client registration and suddenly remembered a task I have to do next. Click on the menu above New Task and will open a popup and close it can keep customer records. The idea is that it is possible to anywhere in the system.
Is this possible?
Reply
#2

Hi, and welcome to CodeIgniter! You cannot do that with PHP, so CodeIgniter cannot do it either. This is because of the client-server nature of PHP. Running on the server, PHP executes your script and sends the results to your browser, which is the client. At that point, PHP is no longer in control. It has no idea what keys you're pressing or what you're typing, so it can't do modal popups. For that, you need something that is running on the client, and that would be Javascript.

Now, you say suppose you're performing a client registration and remember another task you must do. Is that task unrelated to the client registration? For example, you are registering client A and suddenly remember you must bill $50 to client B immediately because they are about to print billing invoices? If that is the case, you can just open a second window or tab. Each window and tab operates independently of the other.
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply
#3

Hi,

RobertSF above is correct of course, although I have a suggestion about how I would do it.

I would include the code for an empty, general modal popup window, in the template for each page without content. Then to any button (like 'Add Task') I would use javascript and Ajax to get the content for the default modal window, insert the HTML and activate the pop up. The content would be filled with whatever content is needed (form, info, whatever). The default modal window would come complete with submit function that collects and submits information via ajax, and closes the window (or reports errors).

Then you can have any pop up content at any time on any page.

Best wishes,

Paul.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB