Operations on dynamically created checkboxes

Hi Experts,
                      In my application I have created 10 check boxes dynamically. All check boxes are for selecting different request types which the user can select. Out of these 10 one check box is for "ALL requests". Now I want that if All Check box is clicked all other checkboxes must be checked. I want to use on toggle action of checkboxes on dynamicaaly created checkboxes Is it possible? Or I have to create checkboxes statically and  only then  I can use ontoggle action of checkboxes..
  Please help me in this regard.
  Thanks,
  Pratibha

Hi Amit,
           I have written following code in wddomodifyview. I have declared mr_view as attribute in my view and in component controller of the type IF_WD_VIEW.
METHOD wddomodifyview .
  DATA: lr_container TYPE REF TO cl_wd_uielement_container,
        lr_checkbox TYPE REF TO cl_wd_checkbox,
        lr_node TYPE REF TO if_wd_context_node.
  CHECK first_time = abap_true.
*  lr_container ?= view->get_root_element( ).
  lr_container ?= wd_this->mr_view->get_element( 'TC' ).
  cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
  DATA lo_nd_node TYPE REF TO if_wd_context_node.
  DATA lo_el_node TYPE REF TO if_wd_context_element.
  DATA ls_node TYPE wd_this->element_node.
  DATA lv_str3 LIKE ls_node-str3.
  DATA lv_str1 LIKE ls_node-str1.
  DATA lv_str2 LIKE ls_node-str2.
* navigate from <CONTEXT> to <NODE> via lead selection
  lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
* get element via lead selection
  lo_el_node = lo_nd_node->get_element(  ).
* get single attribute
  lo_el_node->set_attribute(
    EXPORTING
      name =  `STR3`
      value = 'ON_TOGGLE' ).
  lo_el_node->set_attribute(
EXPORTING
name =  `STR1`
value = 'ALL_REQ' ).
  lo_el_node->set_attribute(
EXPORTING
   name =  `STR2`
   value = 'DYNAMIC.ALL_REQ' ).
* navigate from <CONTEXT> to <NODE> via lead selection
  lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
* get element via lead selection
  lo_el_node = lo_nd_node->get_element(  ).
* get all declared attributes
  lo_el_node->get_static_attributes(
    IMPORTING
      static_attributes = ls_node ).
  ls_node-str1 = lv_str1.
  ls_node-str2 = lv_str2.
  ls_node-str3 = lv_str3.
  lo_el_node->set_static_attributes(
    EXPORTING
      static_attributes = ls_node ).
  lr_checkbox = cl_wd_checkbox=>new_checkbox( bind_checked = ls_node-str2
                                              bind_text    = ls_node-str1
                                              on_toggle =    ls_node-str3
                                              view = wd_this->mr_view   ).
  cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_checkbox ).
  lr_container->add_child( the_child = lr_checkbox ).
ENDMETHOD.
  I am getting this error : Access via 'NULL' object reference not possible 
pls help.
Thanks,
Pratibha

Similar Messages

  • Cannot check dynamically created Checkbox

    Hi,
    I cannot check a dynamically created Checkbox which is binded to a dynamically created node.
    The same dynamically created Checkbox can be checked when it is binded to a static node.
    Any ideas?

    Hello MK,
    Checkbox UI element`s property "checked" can be binded only to attribute with type "boolean".
    If you create attribute inside the node, check whether node contains any node elements.
    Could you please post a piece of your code with dynamic attribute and UI element creation?
    Best regards, Maksim Rashchynski.

  • How to handle dynamically created checkboxes in JSP???

    Hello everybody,
    In a JSP page I would like to create checkbox dynamically on every
    result line (detail line), then check in some of them and finally pass the checked lines to a JSP bean which will handle them on a submit button press.
    The problem are:
    - how to index every checkbox in jsp result line in jsp page in order to avoid solutions like this:
    <input type=checkbox" name="value1">
    <input type=checkbox" name="value2">
    etc
    - how to read every checkbox to find the checked ones
    Is there anobody who has any experience from case like this?
    Please, help me.
    Best regards,
    Danny

    Hi, first off, no need to determine what has been checked or not. If the checkbox is checked, on the post, the value will be submitted as part of the request. If the checkbox is not checked, it will not be submitted (it's value will be null). Depending on what you need, I have approached this a number of different ways. One way is to name all checkboxes the same name. If you need to distinguish between two rows in the form, then in the value field for the checkbox, use some type of distinguishing factor, for example,
    <input type=checkbox name=chkName value="1:abc">
    <input type=checkbox name=chkName value="1:def">
    Now, you only have to make one call on the Servlet/JSP receiving the form post, request.getParameterValues("chkName") which will return an array of the non-null Strings that were checked.

  • Error While Calling action on dynamically created checkboxes

    Hi,
         I am calling on_toggle action on dynamicallly created checkboxes . It is giving me error : " Access Via Null Object Not Possible "
    please help.
    Thanks,
      Pratibha

    Hi,
    Check ur application in debuggermode or go to the transaction ST22 and check the error analysis.
    The error may be because u have not assign any action for on toggle. It may be because of any node is initialized and using it....

  • Bind checked value of dynamically created checkboxes to node attruibutes

    This is the scenario:
    I need to Create n checkboxes(dynamically) based on the n elements present in a node. The values in the node are populated at runtime. i need to bind a boolean attribute in this node to the check boxes that are created.
    Any help would be highly appreciated.
    Regards,
    Immanuel

    Hi,
    Try the following:
    1. Create a node with 0..n cardinality with the following structure
    NodeElement
    Column1
    Column2
    Column3
    CheckBoxattribute(boolean)
    2. In the view, right-click on the root container>Apply Template>Table
    3. Select the NodeElement and set the CheckBoxAttribute UI as Checkbox
    In this way u can create a Table with checkbox that are loaded as many elements in the Node at run-time
    The checkbox value can be set / get using:
    wdContext().nodeNodeElement().getNodeElementAt(<selectedRow>).get/setCheckBoxattribute(true/false);
    Hope this helps you.
    Regards,
    Poojith MV

  • Dynamically set checkbox with actionscript

    I'm trying to set checkboxes to selected/unselected based on
    variables pulled from a database.
    Problem is when the script is run is stops at this code
    (where cb is the id of a checkbox):
    cb.selected = true;
    The code compiles fine with no errors or warnings.
    Why isn't it possible to set the selected value of checkboxes
    through actionscript? Anyone have any ideas or workarounds?
    Thanks in advance

    Found a solution - here for anyone else who needs it:
    http://www.brucephillips.name/blog/index.cfm/2006/11/16/Dynamically-Create-CheckBoxes-Thei r-Labels-And-Their-Select-Values-In-Flex

  • How to create checkbox group and table dynamically?

    HI All
    How to create checkbox group and table dynamically?
    Regards
    Ravi

    hi
    check this links for creating  tables dnamically
    How to Create a table dynamically?
    Re: how to create a table dynamically in webdynpro
    and for checkboxgroup
    IWDTransparentContainer rootContainer =
    (IWDTransparentContainer)view.getElement("RootUIElementContainer");
    IWDCheckBox check = (IWDCheckBox)view.createElement(IWDCheckBox.class,"Check"+k);
    //Here "check"+k k represents a unique value every time u create so that u wont get a duplicate instance
    check.setChecked(false);
    rootContainer.addChild(check);
    or Re: adding checkboxes dynamically

  • Create checkboxes dynamically

    Hi all,
    how can i create checkboxes in my view dynamically?
    Please specify all classes i need...
    regards

    Hi,
    You would basically need to perform the following steps:
    1) First get the reference of the ROOTUIELEMENTCONTAINER using get_root_element.
    2) Set the desired layout to the container using the obtained reference.
    3) Create an instance of the checkbox using the new_checkbox method of class cl_wd_checkbox.
    4) Specify the correct layout information to this newly created checkbox.
    5) Add the checkbox to the container ui element.
    You would have to mandatorily bind 2 properties of the created checkbox:
    bind_checked & bind_text.
    The state of the checkbox would get saved into the attribute specified by bind_checked
    The text to be displayed beside the checkbox would come from the attribute specified by bind_text
    Try insert the following coding into your WDDOMODIFYVIEW:
    METHOD wddomodifyview.
      DATA: lr_container TYPE REF TO cl_wd_uielement_container,
            lr_checkbox TYPE REF TO cl_wd_checkbox,
            lr_node TYPE REF TO if_wd_context_node.
      CHECK first_time = abap_true.
      lr_container ?= view->get_root_element( ).
      cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
      lr_checkbox = cl_wd_checkbox=>new_checkbox( bind_checked = 'NODE1.ATTR1'
                                                  bind_text    = 'NODE1.ATTR2' ).
      cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_checkbox ).
      lr_container->add_child( the_child = lr_checkbox ).
    ENDMETHOD.
    Regards,
    Uday

  • Assigning a 'dynamically created sequence' value to a variable

    in my procedure i am creating a sequence on the fly, i am preparing the name with some passed parameters like below
    v_seq_name := 'seq_'||loadid||v_table_name;
    execute immediate 'CREATE SEQUENCE '||v_seq_name||' MINVALUE 1 MAXVALUE 999999999999999999999999999 START WITH 1 increment by 1 cache 20';
    and now after doing some operations i need to assign the current value of sequence to a number variable i tried following but not working
    1) v_curr_value : = v_seq_name.currval ;
    2) select v_seq_name||'.nextval' into v_curr_value from dual;
    can you please suggest me how i can get the value in plsql block.

    DIVI wrote:
    in my procedure i am creating a sequence on the fly, i am preparing the name with some passed parameters like below
    v_seq_name := 'seq_'||loadid||v_table_name;
    execute immediate 'CREATE SEQUENCE '||v_seq_name||' MINVALUE 1 MAXVALUE 999999999999999999999999999 START WITH 1 increment by 1 cache 20';
    and now after doing some operations i need to assign the current value of sequence to a number variable i tried following but not working
    1) v_curr_value : = v_seq_name.currval ;
    2) select v_seq_name||'.nextval' into v_curr_value from dual;
    can you please suggest me how i can get the value in plsql block.Well, you haven't given the error you are getting but I guess the procedure isn't compiling? You need to execute immediate any reference to the sequence.
    Having said that, your architecture is probably wrong if you are dynamically creating things in a procedure.
    Why do you need to create them dynamically?

  • How to set a value to a dynamically created node/attribute?

    Hi,
    I dynamically created attributes using the following method,
    IWDNodeInfo cbOptions = wdContext.getNodeInfo().addChild("cbOpt"+count, null, true, true, false, false, false, true, null, null, null);
    cbOptions.addAttribute("opt"+critEle.getQuest_Critid(), "ddic:com.sap.dictionary.string");
    How do i assign a  value to it now, since the node/attribute cannot be accessed via wdcontext?
    On a side note, it seems really troublesome if i need to use a checkbox grp(s) dynamically. I actually need to dynamically create a seperate node + attribute for each checkbox grp i have. Is there any better way to do this?
    Thanx in advance

    Hi
    Steps:
    1) Create the  action click is done statically (you cannot create action dyanmically)
    2) binding the  action click to checkbox dynamically 
    code
    public static void wdDoModifyView(IPrivateDynamicProgrammingView wdThis, IPrivateDynamicProgrammingView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
         if(firstTime){
                      IWDTransparentContainer con=(IWDTransparentContainer)view.getElement("RootUIElementContainer");
              IWDCheckBox checkBox=(IWDCheckBox)view.createElement(IWDCheckBox.class,"ck");
              IWDAction act=wdThis.wdCreateAction(IPrivateDynamicProgrammingView.WDActionEventHandler.CLICK,"");
              checkBox.setOnToggle(act);
              con.addChild(checkBox);
        //@@end
    Thanks and Regards,
    Arun

  • How to synch values of fields (cbo & text) in Master Pages section in dynamically created pages?

    HI folks,
    I have a requirement for a form that has a common master page with a checkbox and text field in it.   The document is basically a table that dynamically adds rows as the user adds entries.   When the first page is full, a second page is dynamically created and the Master page format (including the checkbox & text field) applied to it. 
    When the user sets the checkbox on one page and/or adds text, all of the checkboxes on all of the dynamically created pages (in the master section) and all of the text boxes need to change to show the same values.   
    However, I can't figure out how to address the fields on the other pages.   The number of pages changes from user to user, so I can't address them with a static reference.
    Does anyone know how to keep these fields in synch?
    Thanks in advance!

    It woudl be easier to show than to explain it ...can you share the file? You can send it to [email protected] Include a description of the issue with your email please.
    Paul

  • Dynamic Table checkbox binding problem

    I have a dynamically created table bound to a objectArrayDataProvider where all the columns have a check box. The thing is when I read the values in the objectArray it has the values as I loaded it. If a checkbox is changed in the table the objectArray dosn't get the change. How can I make this happen?
    Thanks in advace.
    Azeroth.

    Hi There,
    This should be of help to you
    http://developers.sun.com/jscreator/reference/techart/2/checkbox_component.html
    Thanks
    K

  • How-to handle dynamically created AppModules with JUApplication, JUMetaobjectManager

    Hi,
    I've got a JClient App, where I want to dynamically create AppModules in the Context of the RootAppModule.
    How can I best do this??? The problem is that I can't really use the JUMetaObjectManager.createApplicationObject method and hence I can't use PanelBindings.....well I can't use the JClient Framework.
    Is there a way to elegantly manage this issue??
    Every solution would be very appreciated! thanks.

    Hi, first off, no need to determine what has been checked or not. If the checkbox is checked, on the post, the value will be submitted as part of the request. If the checkbox is not checked, it will not be submitted (it's value will be null). Depending on what you need, I have approached this a number of different ways. One way is to name all checkboxes the same name. If you need to distinguish between two rows in the form, then in the value field for the checkbox, use some type of distinguishing factor, for example,
    <input type=checkbox name=chkName value="1:abc">
    <input type=checkbox name=chkName value="1:def">
    Now, you only have to make one call on the Servlet/JSP receiving the form post, request.getParameterValues("chkName") which will return an array of the non-null Strings that were checked.

  • Dynamically created HTMLDataTable does not update its chlidren

    I have a very delicate problem that I hope to get help with. I have created a HTML data table dynamically in the Java code. The left-most column contains a checkbox so that I can select and deselect rows in the table. The problem is that the checkbox value is only read from my backing bean but changes to it are not written back.
    The strange thing is that if I create exactly the same data table statically (i.e., as tags in the JSP-page) everything works perfectly fine.
    Is there some strange property that needs to be set when creating the data table dynamically that the JSF-framework automatically sets when it creates the table from the tags?
    Below you see the code for the creation:
    HtmlDataTable component = new HtmlDataTable() ; 
    CColumnHeader   column;
    UIColumn        tableColumn;
    tableColumn = new UIColumn();
    HtmlOutputText textHeader = new HtmlOutputText() ;
    textHeader.setValue("");
    tableColumn.setHeader(textHeader);
    HtmlSelectBooleanCheckbox tCheckBox = new HtmlSelectBooleanCheckbox() ;
    tCheckBox.setValueBinding(  "value", FacesContext.getCurrentInstance().getApplication().createValueBinding("#{data.subItems[0].selected}")) ;                       
    tableColumn.getChildren().add( tCheckBox ) ;
    component.getChildren().addAll( this.uicolumns ) ;
    JSF tag is defined as...
    <h:dataTable id="table" value="#{bean.model}" binding="#{bean.component}" var="data" />This do not work!
    However, the below code do...
    <h:dataTable id="table2" value="#{bean.model}" var="data">
    <h:column >
    <f:facet name="header">
         <h:outputText value="" />
    </f:facet>
    <h:selectBooleanCheckbox value="#{data.subItems[0].selected}" />
    </h:column>
    </h:dataTable>          For what I know these to examples should be equivalent.
    Furthermore, I noticed in the debugger that the attributes of my dynamically created table was not the same as the attributes on the one that JSF created for me. For example, each component that JSF created has got a map entry with the key javax.faces.webapp.COMPONENT_IDS for a ListArray containing the ids of its children. However if I try set this attribute in my code the column is not rendered at all. The UIColumn in the JSF-created table did have a javax.faces.webapp.FACET_NAMES=[header] in its attribute map. I don�t know if this has something to do with it, it was just one thing I noticed.
    Is this a bug or am I missing something?

    Why is that?
    What is it that actually goes wrong here? The two example works
    exactly the same in every aspect but in the first example, the JSF-
    framework only calls the getter method of the selected property and the
    latter case it calls both the getter and the setter. Otherwise the two
    tables works correctly.
    I use the binding attribute to be able to create the HtmlDataTable
    before the actual page is loaded and dynamically populate it with
    different numbers of columns depending on different system states.
    This is the reason why I have to create it dynamically and why I have to
    use the binding attribute.
    What is the reason for this not working? Am I breaking anything in the
    specification?
    What do you mean by "...with the hope that JSF will draw.."? It's is
    drawn, it is just the setter method that is not beeing invoked correctly.

  • Dynamically Create (and reference) Dialog Window Groups

    I'm trying to setup a dialog window that can be easily added to via a CSV file.  The only problem I've run into is; I'm not quite sure how to create the groups dynamically.  Basically, the script setups up a bunch of texture features and then gives the option to save and/or strip that feature.  Below is the basic idea of what I'm trying to do, but the groups are not able to be created in the way that they are shown:
    featArray = [];
    featArray[0] = new Array("Feature Display Name","feature sub-group",'texture',"feature action",'feature type');
    featArray[1] = new Array("Feature2 Display Name","feature2 sub-group",'texture',"feature2 action",'feature2 type'); //etc.
    for(var z in featArray) {
        if(featArray[z][2] == 'texture') {
            w.p1.sp1.add('statictext',undefined,featArray[z][0]);
            w.p1.sp1.g[z] = w.p1.sp1.add('group');
            w.p1.sp1.g[z].orientation = 'row';
            w.p1.sp1.g[z].add('checkbox',undefined,'Save');
            w.p1.sp1.g[z].add('checkbox',undefined,'Strip');
            w.p1.sp1.g[z].children[0].id = featArray[z][0].toLowerCase() + "-save";
            w.p1.sp1.g[z].children[1].id = featArray[z][0].toLowerCase() + "-strip";
    If you change the g[z] to g1, it will create each field correctly (visually), but there is no way to properly reference the check boxes to see which are checked.  Any ideas how, or even if, it is possible to dynamically create a different group for each line of the featArray?  And if so, how to then reference the check boxes in those groups later on?  Thanks in advance for any help!

    You just use the array ie:
    featArray = [];
    featArray[0] = new Array("Feature Display Name","feature sub-group",'texture','feature group','feature type');
    featArray[1] = new Array("Feature Display Name2","feature sub-group2",'texture','feature group2','feature type2'); //etc.
    var w = new Window('dialog','test');
    w.p1= w.add("panel", undefined, undefined, {borderStyle:"black"});
    var x = new Array();
    var count =0;
    for(var z in featArray) {
        if(featArray[z][2] == 'texture') {
            w.p1.add('statictext',undefined,featArray[z][0]);
    w.p1.g = w.p1.add('group');
    w.p1.g.orientation = 'row';
    x[count] = w.p1.g.add('checkbox',undefined,'Save');
    count++;
    x[count] = w.p1.g.add('checkbox',undefined,'Strip');
    count++
    x[0].onClick=function(){
        alert("Checkbox 0 clicked");
    x[1].onClick=function(){
        alert("Checkbox 1 clicked");
    x[2].onClick=function(){
        alert("Checkbox 2 clicked");
    x[3].onClick=function(){
        alert("Checkbox 3 clicked");
    w.test = w.add('button',undefined,'Press to Test');
    w.add('button',undefined,'Cancel');
    w.test.onClick=function(){
    for(var w =0;w<x.length;w++){
        alert("Checkbox " + w + " value = " +x[w].value);
    w.center();
    w.show();

Maybe you are looking for

  • New MBP i5 coming, what kind of improvement to expect from old MBP?

    i got a 15" MBP in very late '07, 2.33 ghz core2duo, 2gb memory, 4m l2 cache, was a solid machine when i got it, now passing on to my sons to replace a nearly dead macbook... i've ordered a 2010 mbp 15" 2.53ghz i5 with the high res antiglare, kept th

  • Apex_collection.update_member - call to results in DEADLOCK

    We have a wrapper procedure that calls 'apex_collection.update_member'. This wrapper procedure is an AUTONOMOUS TRANSACTION (to preserve any collection updates if an error/rollback occurs). We now have the situation where the call to the wrapper proc

  • Adobe Reader document security properties miss-match

    Hi, I've created a document with document assembly allowed and form filling diss-allowed. Infact it's security bitmap mask is: 011011011100 or -2340 So you can clearly see that: bit 9 is off, signifying form filling is NOT allowed bit 11 is on, signi

  • Who/Where can i suggest new features/ changes

    Hi Adobe Devs. Are there someone i can message/mail new ideas, cause it sems like this forum does not seem to be quite the right place. I've been working with flash for some years (since flash4) and i love the program. Honestly i think have some good

  • G-Raid "Click"

    I have a G-Raid 500 and every now and then the hard drives will click, or clunk (sounds like both do it) like the drives are resetting (but not spinning down and back up. Performance is not affected, and most times it happens while the system is idle