Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF problem with Javascript

 
lazarus larry
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have a problem and i don't know how i can resolve it.
I have to call a backingBean method when I click and image in menu.
the code is :

onKlick="hiddenSend(1); //this is in the image tag
<h:commandLink style="display:none" id="commandbutton1" action="#{tariffarioazione.createSetup}" value="New Tariffarioazione"/&rt;//this is the hidden command link

function hiddenSend(num){
if(num==1){
document.getElementById('commandbutton1').click();

}
if(num==2){
document.getElementById('commandbutton2').click();

}

}

Now the weird thing is that for sometimes it works in Explorer but other times i get the message "getElementById(...) is null" and never works in mozilla.
It going me crazy please help me
Thanks Laz
 
sujit suncert
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to use commandButton instead commandLink? For commandLink JSF generates some javascript which might be conflicting..
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"sujit sun certified" please check your private messages for an important administrative matter.
Thanks.
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!