This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes javascript confirm() is not working properly with struts dojo anchor tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javascript confirm() is not working properly with struts dojo anchor tag" Watch "javascript confirm() is not working properly with struts dojo anchor tag" New topic
Author

javascript confirm() is not working properly with struts dojo anchor tag

lydia edward
Greenhorn

Joined: Feb 02, 2011
Posts: 11
Hi
I have a requirement like I need to call javascript confirm box and based on the user's decision i have to call href.
So i am using <sx:a> tag for hyperlink.

<%@taglib uri="/struts-dojo-tags" prefix="sx" %>

<td align="center"><sx:a id="url2" href="%{deleteUrlTag}" executeScripts="true" onclick="return confirm('Do you really want to delete this User');" targets="six" separateScripts="false">Delete</sx:a></td>

Here I am facing following issue:
When user clicks on "No", then also it is calling the href and deleting the user.
Ideally it should go for href in case of when user selects "YES".

I also tried with this solution but that didn't work.

<td align="center"><sx:a id="url2" href="%{deleteUrlTag}" executeScripts="true" onclick="return confirm('Do you really want to delete this User');return false;" targets="six" separateScripts="false">Delete</sx:a></td>


Can you please suggest me the solution for this.

Thanks
Satya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript confirm() is not working properly with struts dojo anchor tag
 
Similar Threads
ajax code injected by ajax request using sx:bind does not work in struts 2.2
Not able to call javascript function from struts tag
Struts2.1 div problem in tabbedpanel
Ajax not working on IE. Undefined error
spaces while populating using s:iterator