• Post Reply Bookmark Topic Watch Topic
  • New Topic

Having a hard time to figure out why js won't work

 
Rafael Campos Cruz
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!

I'm currently meddling with javaScript in order to implement a fingerPrinting system in my web application.

I've developed the following example in which I can get all the necessarily data:



It does exactly as it's supposed, and when I read the variables on the "teste" ManagedBean they are there as expected. The javaScript code is the following:



Which works correctly.

So when I tried to run it in the following page:



It simply won't work!

The function faz() is called and only the first "alert" popup is called, the second one which should show what is returned by dadosDaTela() isn't generated, why is that?
I simply cant see any reason for it to be so, could anyone help me?
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Putting javascript inline on an xhtml View Template is a bit risky since some perfectly legal Javascript code looks like broken bits of xml. So I usually prefer to put my javascript in a separate included ".js" file. It's also easier to set breakpoints that way.

My best guess as to your problem is that probably the function in question is throwing an exception and the message isn't making it back to you. You might try putting some alert popups as the first and last executable lines in function dadosDaTela.

Also make sure that the "onclick" function is OK. The button's JSF submit mechanism is enabled or suppressed by the return value.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!