• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

confirm of h:commandLink

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, is it possible to show a "alert confirm" on <h:commandLink as demand of confirm ? If yes, how do I do? Thanks.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


the space in on click is the fictitious! the name is together!

alright?

bye!
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand! Do you repeat, please?
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already used this method, but there is a error: "onclick is invalid for tag commandLink"... Why?
 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
will onmouseup help ? i didnt test it though.

thanks,
 
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that the onclick attribute is case sensitive, unlike it's HTML counterpart. My spidey sense suspects this is your problem.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure you can't just use a commandButton for all this?
 
Wendell Miranda
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the work 'on' and 'click' is together.

okays?

Test and tell me!
 
Wendell Miranda
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
not work, is words 'on' and 'click' is together!

sorry!
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wendell is right, h:commandLink does have an onclick attribute. But if you write:

<h:commandLink onclick="return confirm('Are you sure?');" ...>

The behaviour will not be right: the confirm dialog pops up, but pressing OK seems to have the same effect as pressing cancel! If you view the source code for the HTML page you will see why:

<a onclick="return confirm('Are you sure?'); ... more stuff ..."

JSF is also adding script to the link's onclick attribute. Zut! The simplest fix is to take that into consideration in your script:

<h:commandLink onclick="if (!confirm('Are you sure?')) return false;" ...>
[ June 01, 2006: Message edited by: Jeff Albertson ]
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"onclick" doesn't supported! I have tried "onmousedown", but also window confirm is shows, but if the answer is positive or negative remain of same page
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you read my post? onclick is supported for me (I'm using MyFaces).
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In effect, 'onclick' is implicit in of h:commandLink ! But if I use an other attribute, as onmousedown, doesn't come execute nothing, not even the action. I don't know!
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, onclick is an attribute of commandLink: take a look at the API.

As for the problems you are still having, have you tried my suggestion:

<h:commandLink onclick="if (!confirm('Are you sure?')) return false;" ...>
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I have tried 2-3 day ago, but error is:

"org.apache.jasper.JasperException: /listUsers.jsp(74,6) Attribute onclick invalid for tag commandLink according to TLD
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
...."
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What implementation of JSF are you using? As the link I posted *proves*, onclick is an attribute of commendLink.
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use JSF 1.1.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by rosaria italia:
I use JSF 1.1.



My above link was for 1.2, but here it is for 1.1:

http://java.sun.com/javaee/javaserverfaces/1.1/docs/tlddocs/h/commandButton.html

... as you can see, the onclick attribute was present back then, too.

I notice that you write that you "use JSF 1.1". That's the specification, not the implementation. You may want to reconsider the implementation you are using, whatever it is.
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, my question is for h:commandLink ... as you can see in the title of topic and not for h:commandButton that you have indicated with link that you posted me...

This is my version:
Specification Version: 1.1_01 Final Release
Reference Implementation (RI) Version: 1.1_01 FCS

Thanks.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about my confusion. I now see that for h:commandLink, onclick is present on the JSF specs version 1.2, but not 1.1:

http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/tlddocs/h/commandLink.html
http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/h/commandLink.html
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks 1000!

Now I'm sure that for my version it is impossible!
Bye.

P.S.
Could You have a look at my other topic(convertDateTime) for a little help?
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic