SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    USA
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using confirm to delete a action...

    Hi Everybody,

    I am using struts in my j2ee application. I am using js function to call delete action. But, this function never gives call to delete action. It gives me prompt, but when I click on 'yes', it never calls that action. What's worng wih it? Looks so simple.

    Here is the function -

    Code:
    function deleteview() {
       var answer = confirm('Delete this view?');
    			
       if (answer) {
         location.href="/ReDeleteView.do?viewName=" + view ;
         return;
      } 
    }
    Thanks,

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)

    confirm

    Maybe you could change it to something like
    HTML Code:
    	if (confirm(Delete this view?'))
    	{
    		location.href="/ReDeleteView.do?viewName=" + view ;
    		return true;
    	}
    	else
    	{
    		return false;
    	}

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    USA
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. But, same result again.

  4. #4
    I ♥ PHP
    Join Date
    Jul 2003
    Location
    Melbourne, Australia
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi newperllearner, have you tried just returning a couple of alerts based on the result of the condition? Have you tried executing the loaction.href modification without the use of the confirmation box? Are both working? I have created an extremely basic confirm alert test that works fine.

    http://sandbox.windebank.com.au/Confirm

    This is an interesting dillema. Do you get any Javascript errors when using the Javascript console in firefox?

    Regards,
    Jordan


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •