Create input field dynamically

Hi.
I need to create always a new input field to page when pushing button. How this can be done? How can I define that a new field is placed under another?
Something like this?
javax.faces.component.UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
          UIComponent form = root.findComponent("form1");
          HtmlInputText input2 = new HtmlInputText();
          input2.setSize(50);
          form.getChildren().add(input2);
Message was edited by:
basti78

javax.faces.component.UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
UIComponent form = root.findComponent("form1");
HtmlInputText input2 = new HtmlInputText();
input2.setSize(50);
form.getChildren().add(input2);
I did this in doActionMethod but nothing happened. Is that panelGrid only for layout and it has nothing to do component visibility? Could you pass me an example?
I also find this kind of example:
Application application =
FacesContext.getCurrentInstance().getApplication();
          outputText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
          outputText.setValue("test outputText ");
          form.getChildren().add(outputText);
          try {
               outputText.encodeBegin(FacesContext.getCurrentInstance());
               outputText.encodeChildren(FacesContext.getCurrentInstance());
               outputText.encodeEnd(FacesContext.getCurrentInstance());
          } catch (IOException e) {
               e.printStackTrace();
null

Similar Messages

  • Module pool to create input field dynamically.

    Hi All,
    I have a requirement in module pool programming,
    Where I have one input field,based on the value given in this input I have to get the
    input fields dynamically in the screen.
    Is it possible to achieve this?
    If yes, please do tell me the solution to approach this requirement.
    With Regards,
    S.Asha.

    Hi,
    You can use IMPORT DYNPRO / EXPORT DYNPRO.
    Please check this URL: [Import/Export dynpro not working|Import/Export dynpro not working]
    [EXPORT DYNPRO or GENERATE DYNPRO|EXPORT DYNPRO or GENERATE DYNPRO]
    Cheers,

  • How to get the co-ordinates of a dynamically created input field

    Hello Frn's
    i have created a dynamic text view . but this text view is not appearing at proper position . I want palce it infront of a dynamically created input field . how can i do this ?
    as i am thinking ...i should first of all  get info about the co-ordinates of   dynamaclly creatd input field . and with respect to these co-ordinates ...set the position of  text View .
    Please suggest  your thoughts .
    Thanks and Regards
    Priyank Dixit

    Hi,
    There is no provision in WD for getting screen coordinates and then placing the UI element.
    You to add the UI element to layout editor and based on the layout type it will add the UI element to respective position.
    I would advice not to create dynamic UI elements( instead you can create them statically and then play with visibility status through context binding ). This will be more effective way and less error prone. This is also recommended practice.
    still,For dynamic creation you can refer to following wiki:
    http://wiki.sdn.sap.com/wiki/display/WDABAP/CreatingUIElementsDynamicallyinAbapWebdynpro+Application
    regards
    Manas Dua

  • How to delete Dynamically created input field UI Element

    Hi all,
              I want to delete dynamically created input field and label.
    Is there any method please tell.
    Thanks in advance
    Hemalatha

    Hi,
    In the WDEVENT parameter of the action handler you can find the event id.
    ***Variables
      DATA:
        lv_selected  type string.          "Selected tab value
    ***Structure and internal table for the Events and messages
      DATA:
        lt_events type WDR_EVENT_PARAMETER_LIST,
        ls_events type WDR_EVENT_PARAMETER.
    ***Field symbols
      field-symbols: <fs_value> type any.   "Attribute value in events table
    ***Move the event table to lt_events
      lt_events = wdevent->parameters.
      read table  lt_events into ls_events with key name = 'SAVE'.  "Button Id
      if sy-subrc eq 0.
        assign ls_events-value->* to <fs_value>.
        if sy-subrc eq 0.
          lv_selected  = <fs_value>.
        endif.                 "IF sy-subrc eq 0.
      endif.                 "IF sy-subrc eq 0.
    Regards,
    Lekha.

  • Creating Input Field inside Docking Container bar

    Hello.
    Does anyone know how I can put an input field inside a docking container object ? Just like it appears in SE80.
    I have created a docking container bar, and in one of those bars i want to put a text field.
    Anyone please ?
    Thank you
    EDIT----
    I found how to do this with cl_gui_container_bar_2 and with dynamic documents.
    Edited by: Ricardo Monteiro on Aug 25, 2010 1:30 PM

    Hi,
    Check Program SAPSIMPLE_TREE_CONTEXT_MEN_DEM and check event node_context_menu_request
    Hope this helps you.
    Thanks,
    Prashanth
    Edited by: Prashanth KR on Jun 2, 2009 7:50 AM

  • Create Input Field within ALV Toolbar

    Hi,
    I've created an ALV table using the CL_SALV_TABLE class. I'm now trying to include an input field within the ALV toolbar. I would also require this field to do an F4 to obtain its values. Can anyone help me?
    Thanks and regards,
    Adeline.

    Hi Adeline,
    as Rich explained: Not inside ALV toolbar. If you do not use full screen display but have a screen container for this, you may define a subscreen area on top of ALV container. Use CALL SUBSCREEN <area> INCLUDING <prog> <dynp> syntax to process the subscreen. Define PROCESS ON VALUE-REQUEST for F4. In PAI (PROCESS AFTER INPUT) you can modify the table displayed in the grid and do a new display.
    Regards,
    Clemens

  • Password type input field - dynamically

    Hello,
    I can dynamically ask for user input using the APEX_ITEM package. My problem is that I'd also like to input passwords this way, but I couldn't find the appropriate function in APEX_ITEM. Is there a way to dynamically generate password-type input fields with the '*****' input style?
    Any help will be much appreciated,
    Denes Toth

    You are right, the APEX_ITEM API doesn't generate a input type="password" field.
    See Display as Password in updateable report for an alternative approach.

  • How to set default value to input field dynamically

    Hello Experts,
    I am using adobe forms inside Webdynpro Java.
    Adobe form is having few input fields where at run time i want to assign default value to those fields.
    How can i do it ?
    Thanks in advance,
    Vinay
    Edited by: VINAY on Feb 24, 2011 6:39 AM

    Hi Mate,
    Just set the value to the webdynpro context fields on view init.
    if its like that will override the values entered by use on the form.
    just check if the default value is equall to the field value if yes leave it, if not dont touch that field.
    does this make sense...?
    Cheers,
    Sai

  • How to create internal fields dynamically

    Hi,
    I am getting the data from MARA table to an internal table. Now I have to show the data according to month wise, like if same material is created in may and just, i have to show that material in may and june like below.
    material | may | june |
    m1        |    10 |     5 |
    m2        |    20 |   15 |
    I have to show this report in ALV.
    so how can i get the month columns dynamically for each month?
    i.e., when month is changed it has to create a new month.
    Plz suggest me.
    Regards,
    Dhanunjay

    REPORT ztest.
    *** Tables
    DATA: LT_DATA type ref to DATA.
    DATA: LT_FIELDCATALOG type LVC_T_FCAT.
    *** Structure
    DATA: LS_FIELDCATALOG type LVC_S_FCAT.
    *** Data References
    DATA: NEW_LINE type ref to data.
    *** Field Symbols
    FIELD-SYMBOLS: <FS_DATA> type ref to DATA,
                   <FS_1> type any table,
                   <FS_2>,
                   <FS_3>.
    LS_FIELDCATALOG-FIELDNAME = 'MANDT'.
    append LS_FIELDCATALOG to LT_FIELDCATALOG.
    LS_FIELDCATALOG-FIELDNAME = 'CARRID'. "Fieldname
    LS_FIELDCATALOG-INTTYPE = 'C'. "Internal Type C-> Character
    append LS_FIELDCATALOG to LT_FIELDCATALOG.
    LS_FIELDCATALOG-FIELDNAME = 'CONNID'.
    LS_FIELDCATALOG-INTTYPE = 'N'.
    append LS_FIELDCATALOG to LT_FIELDCATALOG.
    LS_FIELDCATALOG-FIELDNAME = 'FLDATE'.
    LS_FIELDCATALOG-INTTYPE = 'D'.
    append LS_FIELDCATALOG to LT_FIELDCATALOG.
    LS_FIELDCATALOG-FIELDNAME = 'PRICE'.
    LS_FIELDCATALOG-INTTYPE = 'P'.
    append LS_FIELDCATALOG to LT_FIELDCATALOG.
    LS_FIELDCATALOG-FIELDNAME = 'CURRENCY'.
    LS_FIELDCATALOG-INTTYPE = 'C'.
    append LS_FIELDCATALOG to LT_FIELDCATALOG.
    assign LT_DATA to <FS_DATA>.
    call method cl_alv_table_create=>create_dynamic_table
         exporting
           it_fieldcatalog = LT_FIELDCATALOG
         importing
           ep_table = <FS_DATA>
         exceptions
           generate_subpool_dir_full = 1
           others = 2
    if sy-subrc <> 0.
    endif.
    *** So <FS_1> now points to our dynamic internal table.
    assign <FS_DATA>->* to <FS_1>.
    *** Next step is to create a work area for our dynamic internal table.
    create data NEW_LINE like line of <FS_1>.
    *** A field-symbol to access that work area
    assign NEW_LINE->*  to <FS_2>.
    *** And to put the data in the internal table
    select MANDT CARRID CONNID FLDATE PRICE CURRENCY
      from SFLIGHT
      into corresponding fields of table <FS_1>.
    *** Access contents of internal table
    loop at <FS_1> assigning <FS_2>.
    assign component 1 of structure <FS_2> to <FS_3>.
    write: / <FS_3>.
    endloop.

  • How to display input fields dynamically in PCR

    Dear SDN Community,
      In Position Change PCR, I would like to display different wagetypes the employee has got. Some of the employees has got 1 and others has got 2,3,4. Can you please tell me how do I achieve displaying these wage types dynamically.
    Thanks!
    Surya.

    Hi Surya,
    Good that you have taken time to update the thread.
    Thanks and regards,
    - anto.

  • Add Dynamic Input field

    Hi...Experts am new in ABAP Webdynpro. Actually my application is Add Dynamic Input Field in webdynpro. Already One lable, one Input field is there and I add one more button. When I click that button Dynamically Adding same like existing lable and inputfield.Can anyone tel me how to resolve my problem.

    Hi..Yugesh
    U will try this,Definitly Ul get Answer.
    For Dynamically creating Attribute
    DATA : rootnode_info TYPE REF TO if_wd_context_node_info,
    dyn_node_info TYPE REF TO if_wd_context_node_info,
    dyn_node TYPE REF TO if_wd_context_node.
    DATA : dyn_attr_info TYPE wdr_context_attribute_info.
    dyn_attr_info-name = 'NAME'. Attribute Name
    dyn_attr_info-DEFAULT_VALUE = 'Prakash'. +Iam Setting Default value of attribute,u can change as per ur requirement +
    dyn_attr_info-type_name = 'ZDE_NAME' . Data Element(CHAR20) ( Type Of Attribute )
    rootnode_info = wd_context->get_node_info( ).
    CALL METHOD rootnode_info->add_attribute
    EXPORTING
    attribute_info = dyn_attr_info.
    This will create a attribute at run time...
    For Dynamically creating Input Field
    DATA lr_container TYPE REF TO cl_wd_uielement_container.
    DATA lr_input TYPE REF TO cl_wd_input_field.
    DATA lr_table TYPE REF TO cl_wd_table.
    DATA lo_nd_sflight TYPE REF TO if_wd_context_node.
    DATA lr_button TYPE REF TO cl_wd_button.
    DATA lr_grid_data TYPE REF TO cl_wd_grid_data.
    DATA lr_flow_data TYPE REF TO cl_wd_flow_data.
    DATA lr_matrix TYPE REF TO cl_wd_matrix_head_data.
    +Note : Before that change the Layout of ROOTUIELEMENTCONTAINER to MATRIX LAYOUT +
    navigate from <CONTEXT> to <SFLIGHT> via lead selection
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    CALL METHOD cl_wd_input_field=>new_input_field
    EXPORTING
    bind_value = 'NAME' + attribute which i created above+
    id = 'INPUT1'
    RECEIVING
    control = lr_input.
    lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_input ).
    lr_input->set_layout_data( lr_matrix ).
    CALL METHOD lr_container->add_child
    EXPORTING
    index = 1
    the_child = lr_input.
    ENDIF.
    Code it in WDDOMODIFYVIEW...

  • Dynamically bind input field

    Hi all
    I have input field and it already binded context attribute .I am working on enhancement frame work so I can not modify propety of context attribute.My requirement is to create new attribute and bind it with input field dynamically.
    I am able to create context attribute and bind it to input field but it's not working ,can we do it dynamically????
    Pls help
    Regards Reeha

    Hi,
    if you already have a context attribute than you can do this, I just created a test application to create one input field and bind it with a context attribute dynamically.
    my context is like this:
    SUBS_TYPE_NODE   <------node name
    -SUBS_TYPE_VALUE  <----node attribute type string
    under WDDOMODIFYVIEW i did this:
    if first_time = abap_true.
    DATA:
        lr_container TYPE REF TO cl_wd_uielement_container,
       lr_input TYPE REF TO cl_wd_input_field.
    get a pointer to the RootUIElementContainer
        lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' )
        lr_input = cl_wd_input_field=>new_input_field(
        bind_value = 'SUBS_TYPE_NODE.SUBS_TYPE_VALUE'  "notice here how I passed the node and its attribute
        id =   'INPUT_F1'
        view =  view ).
        cl_wd_matrix_data=>new_matrix_data( element = lr_input ).
        lr_container->add_child( lr_input ).
    endif.
    hope this helps...
    AS.

  • Dynamically  Visibilty of Input Field in Interactive PDF Form

    Hi All,
    I want to bind the visibilty of Input Field dynamically in an Interactive PDF Form. How can I do ?
    Please give me some solution
    Regards
    Manish

    Manish,
    Well select the inputfield & check the Scripting Window in your Designer.
    On its top, you will see an option something as Show: Events with Scripts.
    Select the initialize event and insert the code she mentioned. Then click on + sign. This will enter your changes.
    There will be language option on top as well. Select JavaScript from it.
    So in the end your code should read something like this.
    ----- data.<YourFormName>.txtInput::initialize: - (JavaScript, client) ----------------------------------
    txtInput.presence = "invisible";
    Chintan

  • How to link label with an input field in data table?

    I am curious if there is a nice way to link a label to input field in a data table directly in JSP? Data filling the table are dynamically bounded.
    Sample, simplified code below. Values of "label" property are unique in the collection binded to dataTable.
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:jsp="http://java.sun.com/JSP/Page">
         <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" />
         <f:view>
              <html>
              <body>
              <h:dataTable value="#{screen$monitoring$errorlog$CorrectHopper.dataset}" var="DATA_ROW">
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Name" />
                        </f:facet>
                        <h:outputLabel value="#{DATA_ROW.label}" for="#{DATA_ROW.label}_id" />
                   </h:column>
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Value" />
                        </f:facet>
                        <h:inputText value="#{DATA_ROW.label}" id="#{DATA_ROW.label}_id" />
                   </h:column>
              </h:dataTable>
              </body>
              </html>
         </f:view>
    </jsp:root>
    returns:
    17:39:01,390 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.IllegalArgumentException: #{DATA_ROW.label}_id
    what is related to EL expression in h:inputText's "id" attribute.
    Is there any other way to bind label with dynamically created input field in JSP? Do I really have to bind input field directly to component objects with "binding" and set IDs manually with setId() (what is ugly solution because it moves View related logic to Model layer)?

    I've thought of using EL because I have to somehow
    link a label to an input field dynamically. Somehow? Dynamically? Just use plain text :)Well... just look at my code snippet (notice: we want to join the pairs of labels and text boxes placed in a datatable [or any other repeater-like component rendering properties of objects from a collection]):
    <h:dataTable value="#{screen$monitoring$errorlog$CorrectHopper.dataset}" var="DATA_ROW">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name" />
    </f:facet>
    <h:outputLabel value="#{DATA_ROW.label}" for="#{DATA_ROW.label}_id" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Value" />
    </f:facet>
    <h:inputText value="#{DATA_ROW.label}" id="#{DATA_ROW.label}_id" />
    </h:column>
    </h:dataTable>
    and what is your idea of using plain text as "id" attribute value in this case? :)
    Regards,
    Michal

  • How to set number of characters in input field ?

    I am creating an input field dynamically (via CL_WD_INPUT_FIELD).
    I am binding the value (via BIND_VALUE) to an attribute with type CHAR30.
    I want to give the possibility to enter a number with 4 digits (0 - 9999).
    Is it possible to restrict the number of characters that can be entered to 4 (although the BIND_VALUE attribute has a type CHAR30, that allows 30)?
    I have tried it via set_length, bind_length but it seems that the length of the BIND_VALUE attribute overrules the length information...

    Hi Moritz,
    AFAIk you have no other option as using a NUM4 here.
    Set Length just sets the lengths of the inputfield according to the current character set ... count of charcters but does not limit the value you may enter
    Cheers
    Sascha

Maybe you are looking for

  • Help with logging in to MacBook Pro.

    I Got a MacBook Pro today and i was abler to log in fine. But when I changed the password to something personal to me so no one could get in it, after entering it, I wAsnt able to log in. So I put in the installation disk and reset everything and cha

  • [HP Photosmart D110a] Printer won't connect to network

    Printer: HP Photosmart D110a Operating system: Mac OSX 10.6.8 I'm living in a dorm room and trying to wirelessly connect my printer to my computer. I can't connect my printer to my university's network because it's protected. Instead I've been connec

  • Order with referance  to a contract using BAPI_SALESORDER_CREATEFROMDAT2

    Hi All,   I tried to create an order with reference to a sales contract . 1) I passed the  contract number to the field REF_DOC at header level , But I got the error message" Document 4000003639 doesn't have document " where 4000003639 was the contra

  • My ipod camera is not working it is all pitch black

    when open ipod touch camera its all pitch black how do i fix it ?

  • Tomcat, custom error page, sendError and encoding problems

    Hi All! I have the following code in my index.jsp page: <%     if(hasParent && !imageStore.contains(parent))         response.sendError(404, "Requested image with id=" + parent + " was not found on this server");         return; %>following in the we