Jump to content

Display message in a popup window with greyed out background


vivekam8

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.