aspose file tools*
The moose likes JSF and the fly likes javascript error with jsf button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "javascript error with jsf button" Watch "javascript error with jsf button" New topic
Author

javascript error with jsf button

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
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?


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
try getElementById inside your javascript

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


Thanks,
JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
It doesnt seem to work!

It says "object Expected" ;
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
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

Joined: Sep 27, 2004
Posts: 303
The following solution worked to resolve the error:
Thnx for all the help!

 
 
subject: javascript error with jsf button