jQuery in Action, 3rd edition
The moose likes HTML, CSS and JavaScript and the fly likes window.location.href Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "window.location.href " Watch "window.location.href " New topic


Kirk Martin

Joined: Nov 29, 2004
Posts: 4
I'm having issues with a popup window that's deleting data after verifying the password. The first problem is it's not deleting the name in the database after submitting. The delete problem is most likely the window.location (I haven't used this before so it's probably wrong.) The second problem is if I press enter on the keyboard it bypasses the login screen but it works when I press the submit button.

Can somebody help? Here's the code for the popup. Also I know it's not secure to display the password in the jsp but I'm fine with that for what I'm trying to do. Also I can delete data from other pages but I'm not using javascript to verfy a password. -

This forum doesn't like "onclick" so I put quotes around the word.

[edit - fixed code tags - Eric]
[ January 04, 2005: Message edited by: Eric Pascarello ]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
I would say just post the form to your server side page and handle it that way, but I will try to help you out with this method.


The first problem is due to the window.close event most likely. Also you need to view the page source after it has loaded to verify that the values are filled in from the server side code.

Second problem is the enter key does not call the event. To avoid this I would do is get rid of the onclick and make it called with onsubmit via the form.

<form name="passform" onsubmit="return checkpass(document.passform.pword.value

And change the input button to a submit button
<input type="submit" value="YES">

Now with the script you need to add some other code to keep the form from submitting. You need to add <i>retrun false;</i> after your alert statement and calling the new link statement.


Doing this on the server side would seem to be a lot easier in my mind, Fill in two hidden fields with the action and ids. Submit the form with the action set.

Do an if statement to see if the passwords match, if not return them back to the screen.

If it works, delete the record and write out the string <script>window.close()</script> and that should get rid of the problem.
you need to add return false

If you need to update the parent page with the new information you can do

I agree. Here's the link: http://aspose.com/file-tools
subject: window.location.href
jQuery in Action, 3rd edition