close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Delete Popup Window

Thread began 5/20/2012 6:33 am by bill173836 | Last modified 5/24/2012 11:05 am by Jason Byrnes | 2865 views | 12 replies |

bill173836

Delete Popup Window

I need to add a Delete button to a page. How is it possible to add a popup window like is generated for the _results.php page that says This will permanently remove the record from your database. This action cannot be undone. with buttons?

Also where do you adjust where the box is located? On mine it always appears at the bottom of the page instead of the middle of the page.

Sign in to reply to this post

Jason ByrnesWebAssist

the delete popup window is done using 2 divs that are set to display: none by default.

the first div is an overlay that shows the grey screen in the background, the second div contains the delete form which has a delete button and a hidden form element in it that is used to pass the ID of the record to delete.


the delete button in the results page uses an onClick event to change the ID of the hidden element, and change the display property of the 2 hidden divs:

for example, the delete button on a page i created for a users table looks like this:

php:
onclick="document.getElementById('WADADeleteRecordID').value=<?php echo($row_WADAUsers['UserID']); ?>;document.getElementById('deleteBox').style.display = 'block';document.getElementById('deleteMessage').style.display = 'table';"




and the delete form that is created looks like this:

php:
<div class="black_overlay" id="deleteBox"></div>

    <div class="messageContainer" id="deleteMessage">
        <div class="messageWrapper">
          <div class="messageContent">
            This will permanently remove the record from your database.<br/>
            This action cannot be undone.<br/><br/>
            <input type="submit" value="Delete" class="formButton unstyled" id="Delete" name="Delete" />
            <input type="button" value="Cancel" class="formButton unstyled" id="Cancel" name="Cancel" onclick="document.getElementById('deleteBox').style.display = 'none';document.getElementById('deleteMessage').style.display = 'none';"  />
          </div>
      </div>
    </div>




the initial CSSS for the black_overlay and messageContainer classes uses display: none; to hide them till the delete button is clicked.


the css for the messageWrapper class should use absolute positioning and top: 50%; to position it in the middle of the page.

Sign in to reply to this post

bill173836

I put this code inside the form tags of the form that is being submitted correct or the Delete button won't show up as submit option in the server behavior submit list?

Sign in to reply to this post

Jason ByrnesWebAssist

the code I gave was an example, not the exact code that you should be using.

you need to create this functionality your self, using your own code, or you would be better of letting the wizard create it for you.

Sign in to reply to this post

bill173836

How do you use the wizard to create the code on a page other than the results or detail page. I want it on the update page as the user only gets access to an update page?

Sign in to reply to this post

Jason ByrnesWebAssist

the wizard will only add the delete button to the detail or results pages, it will not add the button to the update page, you will need to do this manually.

like i said, the code I gave was an example of how it is done on the results pages that i created.

you will need to modify the code to fit your pages, using the correct recordset references and correct css.


what i would do is first worry about creating a form that deletes the record, then worry about making it a popup using CSS.

Sign in to reply to this post

bill173836

I created the file then I added the code. Now I get the pop up delete window in 2 separate locations. I've sent a zip file that includes 2 screen shots of the same size window so you can see what is happening. The CSS file that has the css code for the pop up. And the two php files that display the screen captures. Why is the pop up window high on the page in one and low on the page in the other. Shouldn't it be in the center of the page on both?

Sign in to reply to this post

bill173836

Forgot the attachment.

Attached Files
submenu.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you have the overlay and container divs as part of the main page div.

they should not be part of the main page div. the messageWrapper class should use absolute positioning and top: 50%; to position it in the middle of the page.

Sign in to reply to this post

bill173836

Okay it appears this happens whenever I apply a template to the page. How do I get it so that it is not affected by the template. All the body code goes into the body region of the template. A page that doesn't use a template centers the popup but once the template is applied then the popup goes down below.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...