• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

window.location.href

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
<script>window.opener.location.reload;window.close()</script>

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic