Re: Adding a confirmation popup

2009-04-10 Thread Linda van der Pal

Thanks to you both, now at least I know what to experiment with.

Regards,
Linda

Serkan Camurcuoglu wrote:
I think it should be , or you 
should add form submit javascript code into the onclick handler..



Linda van der Pal wrote:

I've put it on a button, might that be why it doesn't work?

Generated line of source code:

onclick="return confirm('Are you sure?');">wicket:id="deleteIcon" 
src="resources/nl.lunaris.bookdb.webui.pages.BookListPanel/null/icons/list-remove.png"/> 




Jeremy Thomerson wrote:
What's the generated JS?  Have you debugged with Firebug, etc, to 
see what's
happening in the JS?  Are you attaching that link to a regular 
anchor tag in
the HTML?  If you're putting it on a span, Wicket will generate an 
onclick

to make it a link - which may iinterfere with your onclick JS.

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, Apr 10, 2009 at 3:38 AM, Linda van der Pal <
lvd...@heritageagenturen.nl> wrote:

 

In the book Wicket in Action I found this example:

public class MyPage extends WebPage {
  public MyPage() {
  Link link = new Link("link") {
  @Override
  protected void onClick() {
  System.out.println("Link clicked");
  }
  };
  add(link);
  link.add(new SimpleAttributeModifier("onclick",
  "return confirm('Are you sure?');");
  }
}

I tried to copy this behavior in my own code, but for some reason, 
it does
show the popup, but then doesn't go on to actually going through 
with the

action (deleting an item) after confirmation.


So here's my code:
private Link createDeleteButton(final ListItem 
item) {

  Link deleteButton = new DeleteLink("delete", item.getModel());
  deleteButton.add(new Image("deleteIcon", new
ResourceReference(BookListPanel.class, "../icons/list-remove.png")));
  deleteButton.add(new SimpleAttributeModifier("onclick", "return
confirm('Are you sure?');"));
  return deleteButton;
}

// This is an inner class in the same class as the method above
@AuthorizeAction(action = Action.ENABLE, roles = { "OWNER" })
private class DeleteLink extends Link {
  private static final long serialVersionUID = 1L;
public DeleteLink(final String id, final 
IModel

model) {
  super(id, model);
  }
@Override
  public void onClick() {
  // delete the book
  try {
  BookSaver bs = new BookSaver();
  BookListData deletedbook = (BookListData) 
getModelObject();

  bs.deleteBook(deletedbook.getIsbn());
  booklistmodel.getObject().remove(deletedbook);
  } catch (SQLException se) {
  error(SQLERROR_GET+ '\n' + se.getMessage());
  } catch (IOException ie) {
  error(IOERROR+ '\n' + ie.getMessage());
  }
  }
}

Any clue what I might be doing wrong?

Regards,
Linda

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





  
 




No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 
270.11.51/2052 - Release Date: 04/10/09 06:39:00


  



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.287 / Virus Database: 270.11.51/2052 - Release Date: 04/10/09 06:39:00


  



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Adding a confirmation popup

2009-04-10 Thread Serkan Camurcuoglu
I think it should be , or you 
should add form submit javascript code into the onclick handler..



Linda van der Pal wrote:

I've put it on a button, might that be why it doesn't work?

Generated line of source code:

onclick="return confirm('Are you sure?');">src="resources/nl.lunaris.bookdb.webui.pages.BookListPanel/null/icons/list-remove.png"/> 




Jeremy Thomerson wrote:
What's the generated JS?  Have you debugged with Firebug, etc, to see 
what's
happening in the JS?  Are you attaching that link to a regular anchor 
tag in
the HTML?  If you're putting it on a span, Wicket will generate an 
onclick

to make it a link - which may iinterfere with your onclick JS.

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, Apr 10, 2009 at 3:38 AM, Linda van der Pal <
lvd...@heritageagenturen.nl> wrote:

 

In the book Wicket in Action I found this example:

public class MyPage extends WebPage {
  public MyPage() {
  Link link = new Link("link") {
  @Override
  protected void onClick() {
  System.out.println("Link clicked");
  }
  };
  add(link);
  link.add(new SimpleAttributeModifier("onclick",
  "return confirm('Are you sure?');");
  }
}

I tried to copy this behavior in my own code, but for some reason, 
it does
show the popup, but then doesn't go on to actually going through 
with the

action (deleting an item) after confirmation.


So here's my code:
private Link createDeleteButton(final ListItem item) {
  Link deleteButton = new DeleteLink("delete", item.getModel());
  deleteButton.add(new Image("deleteIcon", new
ResourceReference(BookListPanel.class, "../icons/list-remove.png")));
  deleteButton.add(new SimpleAttributeModifier("onclick", "return
confirm('Are you sure?');"));
  return deleteButton;
}

// This is an inner class in the same class as the method above
@AuthorizeAction(action = Action.ENABLE, roles = { "OWNER" })
private class DeleteLink extends Link {
  private static final long serialVersionUID = 1L;
public DeleteLink(final String id, final 
IModel

model) {
  super(id, model);
  }
@Override
  public void onClick() {
  // delete the book
  try {
  BookSaver bs = new BookSaver();
  BookListData deletedbook = (BookListData) 
getModelObject();

  bs.deleteBook(deletedbook.getIsbn());
  booklistmodel.getObject().remove(deletedbook);
  } catch (SQLException se) {
  error(SQLERROR_GET+ '\n' + se.getMessage());
  } catch (IOException ie) {
  error(IOERROR+ '\n' + ie.getMessage());
  }
  }
}

Any clue what I might be doing wrong?

Regards,
Linda

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





  




No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 
270.11.51/2052 - Release Date: 04/10/09 06:39:00


  



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Adding a confirmation popup

2009-04-10 Thread Linda van der Pal

I've put it on a button, might that be why it doesn't work?

Generated line of source code:




Jeremy Thomerson wrote:

What's the generated JS?  Have you debugged with Firebug, etc, to see what's
happening in the JS?  Are you attaching that link to a regular anchor tag in
the HTML?  If you're putting it on a span, Wicket will generate an onclick
to make it a link - which may iinterfere with your onclick JS.

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, Apr 10, 2009 at 3:38 AM, Linda van der Pal <
lvd...@heritageagenturen.nl> wrote:

  

In the book Wicket in Action I found this example:

public class MyPage extends WebPage {
  public MyPage() {
  Link link = new Link("link") {
  @Override
  protected void onClick() {
  System.out.println("Link clicked");
  }
  };
  add(link);
  link.add(new SimpleAttributeModifier("onclick",
  "return confirm('Are you sure?');");
  }
}

I tried to copy this behavior in my own code, but for some reason, it does
show the popup, but then doesn't go on to actually going through with the
action (deleting an item) after confirmation.


So here's my code:
private Link createDeleteButton(final ListItem item) {
  Link deleteButton = new DeleteLink("delete", item.getModel());
  deleteButton.add(new Image("deleteIcon", new
ResourceReference(BookListPanel.class, "../icons/list-remove.png")));
  deleteButton.add(new SimpleAttributeModifier("onclick", "return
confirm('Are you sure?');"));
  return deleteButton;
}

// This is an inner class in the same class as the method above
@AuthorizeAction(action = Action.ENABLE, roles = { "OWNER" })
private class DeleteLink extends Link {
  private static final long serialVersionUID = 1L;
public DeleteLink(final String id, final IModel
model) {
  super(id, model);
  }
@Override
  public void onClick() {
  // delete the book
  try {
  BookSaver bs = new BookSaver();
  BookListData deletedbook = (BookListData) getModelObject();
  bs.deleteBook(deletedbook.getIsbn());
  booklistmodel.getObject().remove(deletedbook);
  } catch (SQLException se) {
  error(SQLERROR_GET+ '\n' + se.getMessage());
  } catch (IOException ie) {
  error(IOERROR+ '\n' + ie.getMessage());
  }
  }
}

Any clue what I might be doing wrong?

Regards,
Linda

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





  




No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.287 / Virus Database: 270.11.51/2052 - Release Date: 04/10/09 06:39:00


  



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Adding a confirmation popup

2009-04-10 Thread Jeremy Thomerson
What's the generated JS?  Have you debugged with Firebug, etc, to see what's
happening in the JS?  Are you attaching that link to a regular anchor tag in
the HTML?  If you're putting it on a span, Wicket will generate an onclick
to make it a link - which may iinterfere with your onclick JS.

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, Apr 10, 2009 at 3:38 AM, Linda van der Pal <
lvd...@heritageagenturen.nl> wrote:

> In the book Wicket in Action I found this example:
>
> public class MyPage extends WebPage {
>   public MyPage() {
>   Link link = new Link("link") {
>   @Override
>   protected void onClick() {
>   System.out.println("Link clicked");
>   }
>   };
>   add(link);
>   link.add(new SimpleAttributeModifier("onclick",
>   "return confirm('Are you sure?');");
>   }
> }
>
> I tried to copy this behavior in my own code, but for some reason, it does
> show the popup, but then doesn't go on to actually going through with the
> action (deleting an item) after confirmation.
>
>
> So here's my code:
> private Link createDeleteButton(final ListItem item) {
>   Link deleteButton = new DeleteLink("delete", item.getModel());
>   deleteButton.add(new Image("deleteIcon", new
> ResourceReference(BookListPanel.class, "../icons/list-remove.png")));
>   deleteButton.add(new SimpleAttributeModifier("onclick", "return
> confirm('Are you sure?');"));
>   return deleteButton;
> }
>
> // This is an inner class in the same class as the method above
> @AuthorizeAction(action = Action.ENABLE, roles = { "OWNER" })
> private class DeleteLink extends Link {
>   private static final long serialVersionUID = 1L;
> public DeleteLink(final String id, final IModel
> model) {
>   super(id, model);
>   }
> @Override
>   public void onClick() {
>   // delete the book
>   try {
>   BookSaver bs = new BookSaver();
>   BookListData deletedbook = (BookListData) getModelObject();
>   bs.deleteBook(deletedbook.getIsbn());
>   booklistmodel.getObject().remove(deletedbook);
>   } catch (SQLException se) {
>   error(SQLERROR_GET+ '\n' + se.getMessage());
>   } catch (IOException ie) {
>   error(IOERROR+ '\n' + ie.getMessage());
>   }
>   }
> }
>
> Any clue what I might be doing wrong?
>
> Regards,
> Linda
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Adding a confirmation popup

2009-04-10 Thread Linda van der Pal

In the book Wicket in Action I found this example:

public class MyPage extends WebPage {
   public MyPage() {
   Link link = new Link("link") {
   @Override
   protected void onClick() {
   System.out.println("Link clicked");
   }
   };
   add(link);
   link.add(new SimpleAttributeModifier("onclick",
   "return confirm('Are you sure?');");
   }
}

I tried to copy this behavior in my own code, but for some reason, it 
does show the popup, but then doesn't go on to actually going through 
with the action (deleting an item) after confirmation.



So here's my code:
private Link createDeleteButton(final ListItem item) {
   Link deleteButton = new DeleteLink("delete", item.getModel());
   deleteButton.add(new Image("deleteIcon", new 
ResourceReference(BookListPanel.class, "../icons/list-remove.png")));
   deleteButton.add(new SimpleAttributeModifier("onclick", "return 
confirm('Are you sure?');"));

   return deleteButton;
}

// This is an inner class in the same class as the method above
@AuthorizeAction(action = Action.ENABLE, roles = { "OWNER" })
private class DeleteLink extends Link {
   private static final long serialVersionUID = 1L;
  
   public DeleteLink(final String id, final IModel 
model) {

   super(id, model);
   }
  
   @Override

   public void onClick() {
   // delete the book
   try {
   BookSaver bs = new BookSaver();
   BookListData deletedbook = (BookListData) getModelObject();
   bs.deleteBook(deletedbook.getIsbn());
   booklistmodel.getObject().remove(deletedbook);
   } catch (SQLException se) {
   error(SQLERROR_GET+ '\n' + se.getMessage());
   } catch (IOException ie) {
   error(IOERROR+ '\n' + ie.getMessage());
   }
   }
}

Any clue what I might be doing wrong?

Regards,
Linda

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org