Checkboxgroup
Can anybody please guide me for runtime binding of checked property of checkbox group ?
I have a group of checkbox. I want to set checked property of that checkbox at runtime with the help of context variable . can any body give me proper code snippest for the same ?
There is no property named "checked".
Bind the "texts" property to a context attribute inside a node (cardinality 0:N, selection 0:N). Node elements will represent the check boxes, a check box is selected if the corresponding element is (multi-)selected in the node.
See also Javadoc:
The CheckBoxGroup UI element represents a multiple selection visualized as a group of checkboxes.
Data binding:
The property texts must be bound to an attribute Text living in a context node Values of cardinality 0..n and selection 0..n. The attribute Text must have a simple type like String.
The number of checkboxes is the size of node Values. The displayed texts are the values of attribute Text and the selection is the (multiple) selection of node Values. The check boxes are arranged into rows, the size of each row is limited by property colCount.
Events:
If a checkbox is toggled, the event onToggle is triggered. Event parameter checked contains the new state of the checkbox, property index contains the index of the toggled checkbox.
Armin
Similar Messages
-
Getting selected values from checkboxgroup in jsf
Hello,I am making a jsf project and I am new in this kind of project.I am using a tabset with 2 tabs.In each tab I have inserted a checkboxgroup.Each checkboxgroup is bound with data from a table in my database. What I want is to get the selected checkboxes and according to the selected checkboxes I want to get some data from the database using queries.How do I get the selected values and where do I put the code?
There is a dedicated subforum for JSF. Can you please post your future JSF related topics there? http://forum.java.sun.com/forum.jspa?forumID=427
ellie80 wrote:
Hello,I am making a jsf project and I am new in this kind of project.I am using a tabset with 2 tabs.In each tab I have inserted a checkboxgroup.Each checkboxgroup is bound with data from a table in my database. What I want is to get the selected checkboxes and according to the selected checkboxes I want to get some data from the database using queries.How do I get the selected values and where do I put the code?Are you talking about h:selectManyCheckbox? By a coincidence I have posted a complete example in a topic here: http://forum.java.sun.com/thread.jspa?threadID=5241624 (see reply 10). You can safely remove and keep away the converter if the value type is String or any Number. -
Posting values from a table into checkboxes in a checkboxgroup
Here is my situation.
I have a table I am reading into my web dynpro. There are five fields, each may or may not contain an 'X'.
I have a checkboxgroup in my web dynpro. What I need to do is read field one, and if it is 'X', set the first checkbox in the group to true. Then do the same with the other four fields. I am using a checkbox group because I am reading the labels for the fields from an existing table.
I am have not used a checkboxgroup so this is new to me. Can anyone provide some code examples I can use to get my head around this?
Thanks in advance.Hi,
See the help here. [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/ad884118aa1709e10000000a155106/content.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/cd/ad884118aa1709e10000000a155106/content.htm]
See the example component as described on the help page.
Basically you need a context-node of cardinality 0..n. The number of element in the node represents number of checkboxes in the group.
bind the enabled property based on the value X from the table column. -
Problem displaying CheckboxGroup on JFrame
I was recently assigned the task of creating exams. I am trying to create a CheckboxGroup in a class that was passed the Graphics2D tool. This code compiles with no errors when I call it's method:
setLayout(new GridLayout(1, 5));
CheckboxGroup cbg = new CheckboxGroup();
add(new Checkbox("Never", cbg, false));
add(new Checkbox("Almost Never", cbg, false));
add(new Checkbox("Sometimes", cbg, false));
add(new Checkbox("Almost All The Time", cbg, false));
add(new Checkbox("All The Time", cbg, false));
but nothing displays on my JFrame, I tried to draw it with this line(g2 is my Graphics2D tool):
g2.draw(cbg);
but I get an error when compiling that says draw doesn't work. Am I totally off-track with this or is there a simple Graphics2D method that I use to draw this CheckboxGroup?hiwa: Thanks for the tip, I won't mix those libraries anymore
pete: Here is all of my code so far sorry it's sloppy, I'm just getting back into coding after one semester of Intro to Computer Science using Java almost a year ago::/*this class has main function**************************************************/
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class PDS_Questionnaire
public static void main(String[] args)
//declare JFrame window dimensions
int WIDTH = 500;
int HEIGHT = 400;
//create JFrame
JFrame frame = new JFrame();
frame.setSize(HEIGHT, WIDTH);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//create object of painter class to install onto frame
ScoreCard survey = new ScoreCard();
//add object to frame and set visible
frame.add(survey);
frame.setVisible(true);
/*********************end of class***************************************/
/****************************new class**********************************/
//this class is the JFrame painter, it initiates the Graphics2D class then passes the
//Graphics object to PDS_Scorer so that the PDS_Scorer class can draw on the patientsCard
import javax.swing.JComponent;
import java.awt.Graphics;
import java.awt.Graphics2D;
public class ScoreCard extends JComponent
public ScoreCard()
public void paintComponent(Graphics g)
//recover Graphics2D
Graphics2D g2 = (Graphics2D) g;
//create another class and pass the Graphics2D tool
PDS_Scorer patientsCard = new PDS_Scorer(g2);
//call method to draw the check boxes
patientsCard.drawCheckBoxes();
/*********************end of class***************************************/
/****************************new class**********************************/
import javax.swing.JComponent;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
public class PDS_Scorer extends JComponent
public PDS_Scorer(Graphics2D gTwo)
g2 = gTwo;
public void partA_Scorer()
public void partB_Scorer()
public void partC_Scorer()
public void partD_Scorer()
public void partE_Scorer()
public void partF_Scorer()
public void drawCheckBoxes()
// draw3DRect(int x, int y, int width, int height, boolean raised)
// Draws a 3-D highlighted outline of the specified rectangle.
g2.draw3DRect(10, 10, 10, 10, true); //this works
setLayout(new GridLayout(1, 5));
CheckboxGroup cbg = new CheckboxGroup();
add(new Checkbox("Never", cbg, false));
add(new Checkbox("Almost Never", cbg, false));
add(new Checkbox("Sometimes", cbg, false));
add(new Checkbox("Almost All The Time", cbg, false));
add(new Checkbox("All The Time", cbg, false));
//g2.drawString("One Lazy Fox", 22.5, 55.5);
private Graphics2D g2;
} -
Conversion error in checkboxgroup component.....
hi
i have a checkboxgroup component. first time when i go this particular page no validation error occurs. but when i go to a different page and return back conversion error occurs in that component.
getSubmittedValue() method for that component returns some value when error occurs.
can anyone give some suggestions to resolve the error. or suggestions on the value to be converted for checkboxgroupthe actual code is
<cg:checkboxGroup binding="#{view$UsersSMSReport.action_chkbxgrp}" columns="1" id="action_chkbxgrp" style="width: 100%;"/>
<cg:message binding="#{view$UsersSMSReport.action_msg}" for="action_chkbxgrp" id="action_msg"/>
where cg is the our own tag discriptor file
we use jsp-api.jar and jstl.jar for customization of components.
the taglib file for this tag refers to class
CGCheckboxGroupTag extends UIComponentTag
the setProperties method in above class contains code for convertor
if(converter != null)
if(isValueReference(converter))
javax.faces.el.ValueBinding _vb = getFacesContext().getApplication().createValueBinding(converter);
component.setValueBinding("converter", vb);
} else
javax.faces.convert.Converter _converter = FacesContext.getCurrentInstance().getApplication().createConverter(converter);
component.getAttributes().put("converter", converter);
the design time class for this component is
CGCheckboxGroupBeanInfoBase extends SimpleBeanInfo
they are compiled into a tld file and added as complib file in project
the same component sometimes i get conversion error in validation phase and sometimes i get error in page displaying
java.lang.NullPointerException
ClassName:com.sun.rave.web.ui.util.ConversionUtilities
FileName ConversionUtilities.java
MethodName: convertValueToArray -
Reg. checkboxgroup in NWDS
hii all,
I am developing an application in NWDS, in which i have to put checkboxgroup in a view. I did it. but when the Appl. is deployed in th view I am getting only one check box.without any name.plz give me an idea to insert checkboxgroup through coding into the view...would you provide me any coding.....?Hi,
Have you mapped its texts property to any attribute. Is the attribute contains any value.
Please refer the following link:
[http://help.sap.com/saphelp_nw04/helpdata/en/0a/16e94d251a164392f3a3415c6d643a/frameset.htm]
Following link will help you for data binding.
[http://help.sap.com/saphelp_nw04s/helpdata/en/02/dcba4b70e94c44bce33b766afc9b3d/frameset.htm]
Edited by: Manoj Kumar on Jan 29, 2008 2:22 PM -
CheckBoxGroup, checkBoxOption and netui-data:repeater
Greetings,
How can I have multiple options (<netui:checkBoxOption>) inside a checkbox group (<netui:checkBoxGroup>) dinamycally, using netui tags?
CheckBoxOption doesn't allow using another tag like <netui-data:repeater> as it's parent.
I really appreciate any help.
MarianoTim,
I had a similar issue and I could not find a way via the start index and end index
as you would expect.
However, what you can do is write a method in your JPF and access it via <netui-data:choiceMethod...>
tag.Disdavntage being the repeater tag would still loop through rthe entire set,
but would display only what you want.
<netui-data:repeaterItem>
<netui-data:choiceMethod object="{pageFlow}" method="isLineCounterMaxed">
<netui-data:methodParameter value="{container.index}"/>
<netui-data:methodParameter value="{pageContext.lastLineNumber}"/>
</netui-data:choiceMethod>
<netui-data:choice value="true">
........DIsplay Your Data Here.......
</netui-data:choice >
</netui-data:repeaterItem>
Thanks
Rishi
"Tim" <[email protected]> wrote:
>
Hi,
I am using <netui-data:repeater> tag to display array of object.
This array has 20 elements and I am displaying only 5 elements at one
time and
providing next and previous button to the user.
Can I specify the starting index and the end index in repeater tag so
that I
display
the processing array object values in my repeater tag. -
Creation of checkboxgroup in WebDynpro Dynamically
I want to develope a WebDynpro application, which creates UIs dynamically when the application is running. How can i write code for *CheckboxGroup*
Hi Pinki,
Chk this link..
http://help.sap.com/saphelp_nw04/helpdata/en/da/2bf042493ef54499a77394ef6be096/frameset.htm (Section abt Endpoints while Creating a Web Service for an Enterprise JavaBean)
GS -
Value not loading when using checkboxgroup.
Hi
I am using a checkboxgroup as xtype. I have a cq:widget node whose xtype is checkboxgroup. Inside the node i have one items node. and inside items i have my individual checkboxes. In my dialog whatever i am selecting and submitting is goin to my CRX. But when i refresh and load my component again , all my checkboxes are unchecked. Can somebody please suggest me a solution for this. Its very urgent
Thanks in advance
VeenaI'm running into this same issue. Checkboxes work fine but when they are in a checkboxgroup they don't work. Here is what I am using:
<region
jcr:primaryType="cq:Widget"
fieldLabel="Region"
fieldDescription="Check all that apply"
columns="{Long}10"
xtype="checkboxgroup">
<items jcr:primaryType="cq:WidgetCollection">
<isUS
jcr:primaryType="cq:Widget"
boxLabel="US"
name="./jcr:content/isUS"
inputValue="on"
xtype="checkbox"
checked="checked" />
<isEurope
jcr:primaryType="cq:Widget"
boxLabel="Europe"
inputValue="on"
name="./jcr:content/isEurope"
xtype="checkbox" />
</items>
</region>
<isExclusive
jcr:primaryType="cq:Widget"
fieldLabel="Is Exclusive?"
boxLabel="Yes"
inputValue="on"
name="./jcr:content/isExclusive"
xtype="checkbox" />
Were you able to find a fix? -
Using CheckBoxGroup with in Datarepeater
Hello BEA Experts,
I ahev seen many examples of using the checkbox with in the repeater tag but is there a way to use the checkboxgroup tag with in the repeater item, I am using it as follows , can you let me know if its correct..
Thanks Experts!
Bob
<netui-data:repeaterItem>
<tr class="tablebody">
<td>
<netui:checkBoxGroup dataSource="{pageFlow.nodeIds}">
<netui:checkBoxOption value="{container.item.nodeId}"> 
</netui:checkBoxOption>
</netui:checkBoxGroup>
</netui-data:repeaterItem>It definitely does not work for ordinary property lists.
To do this with property lists:
repeat with x := 1 to Listcount(pList)
prop := PropertyAtIndex(pList, x)
val := ValueAtIndex(pList, x)
--do stuff
end repeat
"Chris Forecast"
<[email protected]> wrote in message
news:eu2pob$mgm$[email protected]..
> "jsaiya" <[email protected]> wrote in
message
> news:eu1to2$kl3$[email protected]..
>> I'm trying to use a "repeat with variable in list"
loop with a property
>> list where the properties are symbols, but it
doesn't seem to work;
>> it just falls through the loop. The same exact code
works when
>> passed a property list where the properties are
integers.
>
> I must admit I've always regarded 'Repeat With In' as
only for use with
> linear lists (and personally I only use it with
single-dimensional linear
> lists, I have seen problems when used with
multi-dimensional ones).
>
> It doesn't work for me with property lists (where the
properties are
> symbols), and as far as I can see it only works with
property lists (where
> the properties are integers) in the special case where
those integers
> start
> at 1 and are contiguous.
>
> That is:
>
> MyList:=[1:10,2:20,3:30]
> total:=0
> repeat with i in MyList
> total:=total+i
> end repeat
>
> will loop through the complete list, but setting MyList
to
> [2:10,3:20,4:30]
> or [1:10,2:20,4:30] will fail. And of course, if the
integers have to
> start
> at 1 and be contiguous then presumably you may as well
use a linear list
> instead.
>
> Chris Forecast
>
>
> -
Setting the CheckBoxGroup column width
Hello guys
I'm using the IWDCheckBoxGroup UI element to display a list of items in my WD application.
It is working fine, but the project designer asked me, to set it width to 100%, to fill all the screen width ( that is inside a EP IView )
My problem is: I'm using 3 columns and it does'nt respect the proportion (33%,33%,33%). Put all the columns agrouped in the left ( or center ) is not an option
Is there any way to set the columns width in the CheckboxGroup?
ThanksTks for your answer, but it didn't solve my problem.
I need to use 100% becouse my checkboxgroup MUST to fill all the page width. My problem as I said is that I don't know how to set the width of the columns. I'm using 3 columns in my checkboxgroup and its widht becomes diferent in runtime.
To create proportional widths I think that I need to set it own width, not the width of the group.
Is it possible? I read the API and didn't find any references about this
Tks again -
CheckBoxGroup - Not Getting Created
hi all,
iam new to Web DynPro, kindly let me know to create a CheckBoxGroup. iam not able to create one following the help material in help.sap.com.
thanks in advance
regards,
ajayHi Ajay,
1. Create a context node "Month" and attribute under it "monthName"
set Selection Cardinality- 0..n for Month node
2. Create a CheckBoxGroup UI element into your view and assign "texts" =Month.monthName by selecting context attribute.
3. In wdInit() write this code
String[] monthNames = new String []
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December",
// 1. Create context elements for node "MonthsOfYear"
List monthsOfYear = new ArrayList();
for (int i = 0; i < monthNames.length; ++i)
IPrivatePcdTreeView.IMonthElement month = wdContext.createMonthElement();
month.setMonthName(monthNames<i>);
monthsOfYear.add(month);
// 2. Bind node to element list
wdContext.nodeMonth().bind(monthsOfYear);
// 3. Initialize selection
//select 2 nd month
wdContext.nodeMonth().setSelected(1,true);
// set lead selection
wdContext.nodeMonth().setLeadSelection(5);
hope this will work
Regards,
Rajeev
Message was edited by: Rajeev Ranjan
Message was edited by: Rajeev Ranjan
Message was edited by: Rajeev Ranjan -
CheckBoxGroup defaultValue doesn't work
WLW 8.1 sp4
Here's what I have setup:
<netui:checkBoxGroup dataSource="{actionForm.fields}"
optionsDataSource="{pageFlow.possibleFields}"
defaultValue="{pageFlow.sessionForm.fields}"/>
// debug - to make sure pageFlow.sessionForm.fields (type String[]) is properly populated by submits
<netui-data:repeater dataSource="{pageFlow.sessionForm.fields}">
<netui:label value="{container.item}" />,
</netui-data:repeater>The check box group are rendered correctly.
On submit, they populate the String[] field in session form correctly.
However, the defaultValue array does not pre-select the check boxes on the browser.defaultValue attribute will not take effect AT ALL if the field is a select box, and allowNull is set to true.
That is, when the form bean field is null, null is a valid value and thus defaultValue attribute is ignored. -
How to know CheckBoxGroup element checked or not
Hi Friends,
I am working on the webdynpro programming and now i got a problem in checkboxgroup.
I need to know whether a checkbox element in the checkboxgroup is checked or not.
Based on that i need to dispaly the text of that checkbox element.
I got the solution to display the text of the checkbox element.But i was unable to place the condition whether that particular checkbox element is checked or not.
Could you people look in to this problem and hope bright answer from you.Hi Sandeep,
There is a <b>onToggle</b> event which you can catch. So you can set what function you want to create on the selection of the checkBox.
It returns a boolean value. Initial value is set to False. So if the checkbox is checked it returns true. you can check for this boolean value in a <i>if()</i>, function and perform whatever function you want to do here in this loop.
I hope this helps you.
Regards
Pravesh
PS: Kindly consider rewarding points if helpful and solved.
<i>Message was edited by: Pravesh Verma</i> -
Checkboxgroup setSelected() problem
Hi,
I have a number items read from a .txt file into a checkboxGroup. I have problem in selecting some of them automatically. Please help me in setSelected() function code:
//get selected automatically
try {
int numOfLines2 = 0;
int count2=0;
String theLine2 = null;
FileReader fr4 = new FileReader("C:/CreatorProjects/Npad_PAIRS_NLP.prs");
BufferedReader br4 = new BufferedReader(fr4);
while ((theLine2 = br4.readLine()) != null) {
numOfLines2++;
fr4.close(); // close the file.
br4.close(); // close the buffer
FileReader fr5 = new FileReader("C:/CreatorProjects/Npad_PAIRS_NLP.prs");
BufferedReader br5 = new BufferedReader(fr5);
listPatientdata = new com.sun.rave.web.ui.model.Option[numOfLines2];
while ((theLine2 = br5.readLine()) != null || count2 <= numOfLines2) {
listPatientdata[count2] = new Option(theLine2, theLine2);
if(count2<=ptftrs) //ptftrs is predefined integer
checkboxGroup1.setSelected(theLine2);
count2++;
} catch(Exception e) {
e.printStackTrace();
}I have no problem in using the code if I want all boxes unselected initially.
thanks in advance.
dr.am.mohan raowhile ((theLine2 = br5.readLine()) != null || count2 <= numOfLines2) {
listPatientdata[count2] = new Option(theLine2, theLine2);
if(count2<=ptftrs) //ptftrs is predefined integer
checkboxGroup1.setSelected(theLine2);
count2++;
} catch(Exception e) {
e.printStackTrace(); My guess is to call setSelected after adding all options to check box group. Try something like:
String valueToSelect = null;
while((theLine2 = br5.readLine()) != null || count <= numOfLines2) {
listPatientdata[count2] = new Option(theLine2, theLine2);
if(count2 <= ptftrs)
valueToSelect = theLine2;
count2++;
checkboxGroup1.setSelected(valueToSelect);best regards
Grzegorz
Maybe you are looking for
-
How many times can you reset the Region?
A few minutes ago, I put a DVD into my MacBook for the first time. It was a Region 1 disc, and immediately Apple's DVD player opened and began playing the disc. I was rather surprised, because the first time I inserted a DVD into my Mac Mini, Apple's
-
Help me out to resolve a conditional problem----pls help
Hi Experts , I have the requirement in which if the apinumber is greater than or equal to 10 then only the rows should get inserted into the well_header_table from products_mv table.I need to use only merge concept and nothing else. I am making use o
-
ONLY screen blending mode doesn't work...?
I have Windows 8, and Photoshop CS6. All of my blending modes work, except for Screen. I don't know why it doesn't, but I do use it somewhat frequently, and it's really holding me back at this point. Is this related to all the other problems people h
-
BAdi for fetching Time Writing hours
Hi all, I want to know is there any BAdi available for fetching approved Time Writing Hours. I came to know about one BAdi -> BADI CATS_APPROVAL where i could not find the appropriate method. Please help me. Thanks in advance. Regards, Kani.
-
Function call another function variable
Is it possible to call another function variable? Below is my Script: f2(); function f1() { var v2 = 1; function f2(v2) { var v3= 2; alert(v2);