Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSF
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSF
problem with radio button
sudhasrinivas pallam
Ranch Hand
Posts: 37
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi
I am using radio button to display 2 diffenent subviews . When we select the option, it doesn't change the view . If we select it and click anywhere in the form then it change the view.
The code i used is
<%@ page language="java" import="com.bnss.avrio.config.Config" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <% Config appConfig = Config.getInstance(); String wpUrl = appConfig.getWorkplaceUrl(); String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>Display Notes</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link type="text/css" rel="stylesheet" href="<%=path%>/common/ps.css" /> <link type="text/css" rel="stylesheet" href="<%=path%>/common/ap.css" /> <link type="text/css" rel="stylesheet" href="<%=path%>/common/Wcm.css" /> <link rel="stylesheet" href="<%=wpUrl%>/forms/css/forms.css" type="text/css"> <script language="JavaScript" src="<%=wpUrl%>/forms/misc/eforms-factory.js"></script> <script language="JavaScript"> var readNotesCell; form.addOnLoad(initHandler); // This handler is called when the form is loaded. // function initHandler() { readNotesCell = form.findCell("ReadNotes"); } function updateEform(readNotes) { if(readNotesCell !== null && readNotes !== null) { readNotesCell.setValue(new Value(readNotes)); } else readNotesCell.setValue(new Value(false)); } function submitNotesForm(readNotes) { var closeWin = true; // get the data from the text field var notesData = document.forms['notesForm'].elements['notesForm:_notes_subview:NotesPage:notesText'].value; // if data is not empty, display a message if(notesData.length != 0) { answer = confirm("The Notes field contains text that has not been added to the Notes history. If you select the OK button then the note text will not be added to the Notes history. Are you sure you want to continue?"); if(answer == 0) closeWin = false; } if(closeWin) { updateEform(readNotes); window.close(); } } </script> </head> <body> <f:view> <h:form id="notesForm"> <f:loadBundle basename="com.avrio.resources.MessageBundle" var="bundle" /> <h:selectOneRadio id="_header_selection" onchange="this.form.submit()" valueChangeListener="#{notes.nameChangeVCL}" value="#{notes.currentRadioItem}"> <f:selectItem id="_notes" itemValue="#{bundle.notes_header_label}" itemLabel="#{bundle.notes_header_label}"/> <f:selectItem id="_activity" itemValue="#{bundle.activity_header_label}" itemLabel="#{bundle.activity_header_label}"/> </h:selectOneRadio> <f:subview id="_notes_subview" rendered="#{!notes.notesSelected}"> <jsp:include page="/notes/displayNotesResults.jsp" /> <h:commandLink> <h:graphicImage url="/images/close.gif" onclick="submitNotesForm(#{notes.notesExist});return false"></h:graphicImage> </h:commandLink> </f:subview> <f:subview id="_activity_subview" rendered="#{notes.notesSelected}"> <jsp:include page="/notes/dispalyActivityResults.jsp" /> <h:commandLink> <h:graphicImage url="/images/close.gif" onclick="self.close();return false;"></h:graphicImage> </h:commandLink> </f:subview> </h:form> </f:view> </body> </html>
help me out
Rajneesh Kumar Rajput
Ranch Hand
Posts: 39
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Pallam,
This seems to me
java
script behaviour which is already known in
JSF
radio button. Please use onClick intead of onChange.
see...
http://wiki.apache.org/myfaces/Radio_Buttons_and_Browsers
sudhasrinivas pallam
Ranch Hand
Posts: 37
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Rajneesh Kumar,
Thanks a lot for the reply i tested it and it worked...
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Component ID frm1_window viewid has already been found in the view
h:commandLink will not work inside a h:dataTable
add Flash Object
What is the problem with this code!!!
Error with http://java.sun.com/jsf/core
More...