• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javascript error with jsf button

 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a jsf page like



The javascript function is as follows:



This code works absolutely fine with normal html buttons.
with JSF, it says document.frmHolidayType.rdoHoliday is null or not an object. How do i resolve this?
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try getElementById inside your javascript

var obj = window.document.getElementById("selBuiltBy");


Thanks,
 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesnt seem to work!

It says "object Expected" ;
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok try this

var obj = window.document.getElementById("form1:rdoHoliday");

see the clientID of the component in backing bean and pass it in the
getElementById() of javascript

System.out.println("client id " + getRdoHoliday().getClientId(getFacesContext()));

Thanks,
 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following solution worked to resolve the error:
Thnx for all the help!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic