-
1. Re: Display error message using javascript alert
harut Apr 15, 2010 3:30 AM (in response to r4nd7263)You can store error message in your bean class any String property:
private String errorMessage = "";
Initialize "errorMessage" in your actionListener method:
........................
errorMessage = "SOME ERROR"
..........................
and set oncomplete attribute of the commandButton:
oncomplete="if (#{myBean.errorMessage != ''}) alert('#{myBean.errorMessage}')"
-
2. Re: Display error message using javascript alert
anudeepshetty Apr 4, 2011 1:52 AM (in response to harut)Hi Harut,
I use the similar alert message in my code ,
onclick="if(!confirm('Are you sure do you want to delete this #{backing_myBean.name}: ?')){return false}"
for some names which has single quotes say backing_myBean.name=o'liver the confirm message wont show up,
and alse onclick="if(!confirm("Are you sure do you want to delete this #{backing_myBean.name}: ?")){return false}"(insdie the confirm i am using the " instead of ') shows error
-
3. Re: Display error message using javascript alert
ilya_shaikovsky Apr 4, 2011 8:45 AM (in response to anudeepshetty)you should escape such chars. see org.ajax4jsf.javascript.ScriptUtils class to check how we dealing with that.
-
4. Re: Display error message using javascript alert
anudeepshetty Apr 4, 2011 9:07 AM (in response to ilya_shaikovsky)I tried using the escpe chars
even this doesnt work
onclick="if(!confirm("Are you sure do you want to delete this o\'liver ?")){return false}"(insdie the confirm i am using the " instead of ') shows error
-
5. Display error message using javascript alert
harut Apr 4, 2011 9:37 AM (in response to anudeepshetty)Hi, try to set "
'
" instead of ' -
6. Re: Display error message using javascript alert
ilya_shaikovsky Apr 4, 2011 9:39 AM (in response to anudeepshetty)try
onclick="if(!confirm("Are you sure do you want to delete this o\\'liver ?")){return false}"
-
7. Re: Display error message using javascript alert
anudeepshetty Apr 4, 2011 10:39 AM (in response to r4nd7263)Finally worked ,
onclick="if(!confirm("Are you sure do you want to delete this o'liver ?")){return false}"