Open a popup browser window to select a record - php

I want to open a popup window on client PC where I will show records. The user will click on the selected row, and the popup window will disappear, but the parent Form on my page must get filled with the DB values related to the clicked row on the popup.
This is what I want to do. What is the right approach?

You should be able to send back some response to your parent window from popup window.
There is a specific javascript methods to do this. See this.

You can also use a modal popup type container which will make communication simpler and give you more control of the data. It'll also work flawlessly even if the client has any sort of popup blocker (which most do by default).
It's easy to build from scratch and there are also many jquery plugins that make it even simpler.

Related

Open messages in popup window - PHP

I want something like when you click on image on facebook, url changes to facebook.com/photo.php?.... but without redirect. I want exactly the same thing but to open the messages, not photos. Simply, i want when user clicks on displayed messages with other users to open a new popup window without redirecting to new page with all messages with that user. Is that possible and if it is please tell me how to do that.
Example:
Messages with user A
Messages with user B
Messages with user C
And when user clicks on 'Messages with user B', it will open new popup window with all messages with that user, and of course, pulled from database.
I decided to write this as an answer since it is too long for a comment.
To "properly" set up what you want, you need several parts working together:
AJAX: (eg: jQuery.ajax) Retrieve data from the server programmatically with javascript
CSS/HTML dialog: (eg: jQueryUI dialog) Create a fake popup inside your page, usually to give the content some prominence
History State: (eg: SO Q/A) Change the page URL (in addressbar) without reloading the page.
I think I understand what you are looking for!
Use case scenario:
1- User looks at a feed of posts/images/anything.
2- User clicks on one of those posts and, it opens in a box with that same content.
The thing you are looking for is called "Lightbox" or "FancyBox".
I googled and found a few examples:
http://fancyapps.com/fancybox/
http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/
http://lokeshdhakar.com/projects/lightbox/
you basically need to recreate the loop or make on a onclick function when user chooses the photo, and just call the index of that photo again inside the lightbox.

Jquery post to reload or refresh Another window

Am developing a php mysql app with codeigniter for users on an intranet. It heavily uses jquery and flexigrid. One of the components on a page is a table which gets populated via jquery post based on user action/actions on other components of the same page ... So far, all works fine.
There are too many components (tables/forms, etc) on this page, and for lack of real estate, users have requested me to add functionality/ability to move one of the components to a new window. I can move the component in question to a new window, but am not sure how I could refresh that new window based on user activity on the default window - and thats where I could use some help.
An example of what I am looking for can be found in phpmyadmin, wherein you are able to edit a sql query in a popup window and on running the query, it updates another window with the results of the query - It also seems to know which window to update/refresh if there are multiple tabs/windows open ...
If you can give any hints on how to proceed with this, that'd would be very helpful ... thanks.
Look for window.opener in jquery you can use your querystring to pass data to the popup/form page

Always on top Popup windows

I need to have a popup window that will overlay a current window such that the user can click back and forth without the popup disappearing behind it. The popup must also be movable. I've tried a few pseudo popups like Zebra. They have a good modal popup, but their displays are not movable and are limited to the current screen only.
Imagine: The user is reading a record and wants to popup more information. Then the user wants to change records on the main screen and bring up a second popup so the two popups display at the same time - and so forth. The user may want to go to another main screen and popup more for further consideration such that there could be multiple popups independent of any main screen and always on top (not of each other, I realize).
In case it matters, I'm on Windows 7 using JQuery along with PHP and MySQL.
Sounds like you are going to want to use the JQuery Dialog Box (http://jqueryui.com/dialog/#default) to create your "popup". With JQuery you'll be able to crete as many "popup" windows as you want.
The difficulty will be "changing the main window" which you would have to load in instead of switching pages in order to keep all your popups. Otherwise you would need to store what popups exist, with all their information in order to re-load them when you switch main windows.
And of course, your popups if you do them through JQuery Dialog Box will always be limited to the Browser window.

Show once popup

Say I wanted to create a popup for my website that only showed once (if the user either filled it out or clicked the "do not display again" button), how would I do so. I am creating the popup and form using javascript and html, passing it in php to a database.
The easiest way would be to use a cookie which would be downloaded to the client's computer. When your webpage loaded, it would need to check for this cookie, and if not found, or a flag inside it had a property "noPopup=true" for instance, not display the popup.

Scroll text down after clicking

I am having difficulties in the following problem:
I have a screen in PHP which displays a list of some records when I choose any of these
records (by clicking) it gives me a web site to share the data with this record. So far, it works.
I need to click on some of these records, instead of him
open another page, scroll down the screen and the record data to appear in the same screen, ie without opening another window.
Do you have any idea how to do this?
Thanks
You'll need to have a DIV at the bottom of the page, which will be completed by using an Ajax call and some javascript or jquery.
Without going into too much detail, heres what needs to happen:
User clicks a link which fires off an ajax request.
The backend PHP script takes the ajax call and generates either XML or pure HTML and returns the data.
JQuery or JavaScript on the original page takes the return and populates the empty DIV at the bottom of the page.
Regards
It sounds like you'll need to use ajax to pull this off.
I would personally suggest starting with reading up on the jQuery javascript library if you are not familiar with it already. It provides a very good set of ajax tools to work with.
Create a DIV layer on the bottom of the page. Use a simple AJAX library like this
Create a new php page that will only load a new record based on the recordID and call this page on the onclick method of your link that is now opening in the new window
I would try adding some jQuery to your page to handle this effect.
If you do add jQuery here is a function written to do just that:
http://pastebin.com/SeMHwSgg
Call the script like so:
Where a is the record you are having them click on and href="[some anchor]" located at the spot on the screen where you want the scrolling to stop:
<a id="gotop" href="#" onclick="goTop();return false;">click here</a>
So
Indeed, there is no error, it just does not have the effect that (scroll down the screen and show the record data). For now, it only shows the record open in another window.

Categories