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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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!

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javascript error with jsf button
 
Similar Threads
How to make one of the Radio button default selected
listbox help needed
Problem using valueChangeListener and onchange
Display value of 'checked' radio button
Issue with Ajax implementation on <h:selectoneradio> control