vivekam8 Posted November 4, 2011 Share Posted November 4, 2011 Guys, I need some help with php coding. I am kind of new to php... I have a page where search results are dislayed. There is a checkbox to select each search result. When the user clicks on a "save to favorites" link (This link is located above all the search results), a popup window will open (with the background greyed out) with appropriate message like: Please login first to Save to Favorites OR Please select atleast one result in order to save to favorites OR Thanks for Saving to favorites! Any help is greatly appreciated... Thanks, Kevin Quote Link to comment https://forums.phpfreaks.com/topic/250431-display-message-in-a-popup-window-with-greyed-out-background/ Share on other sites More sharing options...
Adam Posted November 4, 2011 Share Posted November 4, 2011 Which part do you need help with? What have you got so far? Quote Link to comment https://forums.phpfreaks.com/topic/250431-display-message-in-a-popup-window-with-greyed-out-background/#findComment-1284881 Share on other sites More sharing options...
joel24 Posted November 4, 2011 Share Posted November 4, 2011 you need to use javascript to do this. have a look at the jQuery framework and this tutorial to grey it out, you need to have a div that takes up the entire screen (100% x 100%) positioned on top of the main document but behind the popup (using z-index). Then when a user clicks on 'save to favourites' you set the script to popup the message and the greyed out div. jQueryUI's Shadow has a pleasant shadow/greyed div. *edit* or google for some javascript popup tutorials, though the jQuery framework will make life a lot easier. Quote Link to comment https://forums.phpfreaks.com/topic/250431-display-message-in-a-popup-window-with-greyed-out-background/#findComment-1284882 Share on other sites More sharing options...
vivekam8 Posted November 4, 2011 Author Share Posted November 4, 2011 This is what I have so far. It is opening in a seperate window but I want the background to be greyed out... <FORM ACTION="./save_to_favorites.php" METHOD="POST" NAME="MYFORM" ID="MYFORM" TARGET="MyNewWindow"> <INPUT TYPE="hidden" VALUE="MYVALUE" NAME="T_TYPE"> <A HREF="#" class="link4" onclick="document.MYFORM.submit(MyNewWindow=window.open('./save_to_favorites.php','MyNewWindow','width=500,height=400,stat us=no,location=no,menubar=no,scrollbars=no,resizable=no')); return false;"><b>Save to Favorites</b></A> I am going to read the tutorial that joel24 suggested...Thanks Joel...It is much appreciated... In the meantime, any help is greatly appreciated... Quote Link to comment https://forums.phpfreaks.com/topic/250431-display-message-in-a-popup-window-with-greyed-out-background/#findComment-1284895 Share on other sites More sharing options...
joel24 Posted November 4, 2011 Share Posted November 4, 2011 it will be much easier to pop up a <div> element with the message rather than a new window. Have a look into ajax - I would submit the form with ajax to the save_to_favourites.php and then have the response message displayed in a popup div. If you want to use a new window (some browsers may block this) then you can grey out the current screen using just the popup div and then you'll have to alert the parent window to hide that grey out once the actions are complete. Quote Link to comment https://forums.phpfreaks.com/topic/250431-display-message-in-a-popup-window-with-greyed-out-background/#findComment-1285107 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.