How to create dynamic Textbox in JSP

I created dynamic Textboxes using javascript in JSP.But i want to give every textbox a unique name..But I dont know how to give unique name to all the textbox which are created dynamically.....Can u help me Please.............
<script code="text/javascript">
function dynam(val)
var d= document.getElementById("Bottom");
d.innerHTML='<table>';
for(i=1;i<=val;i++)
d.innerHTML += '<tr><td>Parameter</td><td><INPUT type="text" name="week"'+i+'size = 15></td>';
d.innerHTML +='</table>' ;
</script>in the above code."val" is the integer value passed while calling this function. "Bottom" is the id of <DIV> tag in my JSP page.
My problem is : when i creating a text box. the Unique name of the textbox in not getting generated.All the text bok has the same name as "week",but i want the name to be as week1,week2,week3,.....etc
Edited by: AnilTcs on Jan 21, 2009 1:31 AM

Try this:
d.innerHTML += '<tr><td>Parameter</td><td><INPUT type="text" name="week '+i+' " size = 15></td>';I have just changed the quotes around week. Hope this helps.

Similar Messages

  • Creating dynamic textbox in JSP

    I am trying to create dynamic textbox.when i run this below JS ,I am getting two boxes only and then i nothing getting it displayed.The problem comes in the inner for loop.
    function DynamicBox(val)
                        alert("helloooo");
                         var d =document.getElementById("bottom");
                         d.innerHTML = '<table cellpadding="10">';
                        for(i=0;i<val;i++)
                                d.innerHTML += '<tr><td><INPUT type="text" name="week'+i+'" size=8 >  </td><td><INPUT type="text" name="deliverable'+i+'" size=30>  </td>';
                              for(j=1;j<=<%=parameter.length%>;j++)
                                       <% int m=0;%>
                                      d.innerHTML+='<td><INPUT type="text" name="'+<%=parameter[m]%>+i+'" size=10></td>';
                                      <% m++; %>
                                 d.innerHTML +='</tr><br />';
                            d.innerHTML+='</table>';
                    }In the above code,val is the number of rows to be created.Bottom is the id of the <div> tag.parametr is a String array.The values are coming from database.

    move the <% int m=0;%> out of the loop.. You have place it in the loop, causing it to be initialize to be 0 each time the looping occurs.
    Place <% int m=0;%> below the line: d.innerHTML = '<table cellpadding="10">'

  • How to create dynamic tables in jsp page

    Hi,
    Iwant to create a table with 8 rows.each row will have two select boxes and one text box.besides i have add button.intially the screen shows only one row.if user clicks on add button then another row is added.like this upto 8 rows.
    how can solve this problem..
    regards,

    Hi I am not a big programmer but i can suggest a method to u
    try something like this..
    this could be quite adjusted in html page itself.....
    <html>
    <head>
    <script language="javascript">
    var count=1
    fucntion addRow(){
    if(count<8){
    count=count+1
    row.innerHTML=row.innerHTML+"<tr><td><input type='text' name="+count+"></td><td><input type='button' onclick=addRow() value='Add' name='add'></td></tr>"
    else if(count==8){
    row.innerHTML=row.innerHTML+"<tr><td><input type='text' name="+count+"></td><td></td></tr>"
    </script >
    </head>
    <body>
    <form action='Myservlet" method='post'>
    <table>
    <div name='row' name='row'><tr><td><input type='text' name=1></td><td><input type='button' onclick=addRow() value='Add' name='add'></td></tr></div>
    </table>
    </form>
    </body>
    </html>
    I believe it could be quite adjusted @ client side itself.... as per your description...

  • How to create Dynamic Window in Smartforms

    Hi all,
    Could you please help me out on how to create Dynamic Window in smartforms excluding Main Window.
    Thanks in Advance.
    Vinay.

    hi,
    Hi,
    1.If you are creating the Different windows for the Countries,then In conditions tab of window specify the Condition i.e.
    company -code = '2201'.
    2.Then that window can trigger ofr that condition.
    3.Other wise, if you are using the different layouts ,then write the condition in Print program and call that form .
    reward me if helpful.

  • Can any one give me hint how to create(dsplay) calendar in jsp 1.2

    can any one give me hint how to create(dsplay) calendar in jsp 1.2
    friends
    i wants to display calendar (not the date) in tabular way please give me hint how to create it

    Hi,
    i would just add my question cos it looks similar , how can i add calendar of the whole year and let the user browse and select it
    thanX in advance

  • How to create dynamic context based on a structure defined in the program?

    Hi Experts,
             I need to create a dynamic context based on a structure wa_struc which i have define programatically.
    When I pass wa_struc to structure_name parameter of create_nodeinfo_from_struc, i get a runtime error:
    "Parameter STRUCTURE_NAME contains an invalid value wa_struc."
    How to create dynamic context based on a structure defined in the program?
    I have written the code like this:
    TYPES: BEGIN OF t_type,
                v_carrid TYPE sflight-carrid,
                v_connid TYPE sflight-connid,
             END OF t_type.
      Data:  i_struc type table of t_type,
             wa_struc type t_type.
      data: dyn_node   type ref to if_wd_context_node.
      data: rootnode_info   type ref to if_wd_context_node_info.
      rootnode_info = wd_context->get_node_info( ).
      clear i_struc. refresh i_struc.
      select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
      parent_info = rootnode_info
      node_name = 'dynflight'
      structure_name = 'wa_struc'
      is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( name = 'dynflight' ).
    dyn_node->bind_table( i_struc ).
    Thanks
    Gopal
    Message was edited by: gopalkrishna baliga

    Hi Michelle,
              First of all Special thanks for your informative answers to my other forum questions. I really appreciate your help.
    Coming back to this question I am still waiting for an answer. Please help. Note that my structure is not in a dictionary.
    I am trying to create a new node. That is
    CONTEXT
    - DYNFLIGHT
    CARRID
    CONNID
    As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
    Also I cannot define the structure in the ABAP dictionary because it changes based on condition
    I have updated my code like the following and I am getting error:
    TYPES: BEGIN OF t_type,
    CARRID TYPE sflight-carrid,
    CONNID TYPE sflight-connid,
    END OF t_type.
    Data: i_struc type table of t_type,
    dyn_node type ref to if_wd_context_node,
    rootnode_info type ref to if_wd_context_node_info,
    i_node_att type wdr_context_attr_info_map,
    wa_node_att type line of wdr_context_attr_info_map.
    wa_node_att-name = 'CARRID'.
    wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
    insert wa_node_att into table i_node_att.
    wa_node_att-name = 'CONNID'.
    wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
    insert wa_node_att into table i_node_att.
    clear i_struc. refresh i_struc.
    select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    rootnode_info = wd_context->get_node_info( ).
    rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
    attributes = i_node_att
    is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
    dyn_node->bind_table( i_struc ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    But now I am getting the following error :
    The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
    The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
    Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
    Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
    Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
    -Gopal
    Message was edited by: gopalkrishna baliga

  • How to create dynamic connection in business view manager.

    Hi Sir,
    Can u explain how to create dynamic connection in business view manager.
    Thanks
    Vishali Raghava Raju

    HI Vaishali,
       Can you please elaborate your requirement ?
    -Regards
    B

  • How to create dynamic variable in Java?

    Hi,
    I want to create dynamic varible , using ArrayList or Vector. The number of array i dont knwo, so how to create dynamic ArrayList or Vector.
    for example:
    ArrayList1,ArrayList2,ArrayList3.....n
    or
    Vector1,Vector2,Vector3 .....n, the n value i will get at run time, so how to create the dynamic ArrayList or Vector or i can use any other Object in java,
    Pls provide your input.
    Sridhar

    1. I have a HashMap with dataok ... fair enough.
    2. depending on its size, i need to create variable
    to store them.uhm ... why? If you have a variable number of elements in the map then you'd need to generate a variable number of variables (a number, that is not know at compile time, as it seems). Now if you could somehow create those variables, how would you access them? You'd have to generate the code handling them as well ...
    Tell us what kind of data you've got and what you want to do with it. There's certainly a better solution to your problem.
    how to generate variables as per content size of the
    HashMapYou don't.

  • How to create dynamic ed flash charts based on user selected fields in Orac

    Hi all,
    Can any of the experts please tellme "how to create dynamic ed flash charts based on user selected fields in Oracle apex".
    Thanks
    Manish

    Hello,
    Lots of different ways to do this, I blogged about one way (using a Pipelined function) here -
    http://jes.blogs.shellprompt.net/2006/05/25/generic-charting-in-application-express/
    Other options include using a PL/SQL function returning the string to use as the dynamic query etc.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • How to create dynamic view in hr report category

    i want to make company code mandetory in in selection screen given by logical data base PNP here i want to make field mandetory. so how to create dynamic view in hr report category.
    thanks in advance

    solved by self

  • How to create dynamic screen using module pool programming

    Hi,
    Could anybody help me how to create dynamic screens?
    I am developing a screen with HR Person with assignment info. If PERNR have multiple assignments, i need to show all the details one by one. How to show the details on screen. I need to call one by one assignment information dynamically.
    Please suggest me how to do, apart from using table controls.
    Thanks,
    Kamal

    You may have the below options:
    1) Table Control
    2) Individual fields
    3) ALV
    4) pop-up screen

  • How to create dynamic window in smartform

    <i>HI Floks</i>
    my requirement is invoice smartform having few line items .i can print this line items with different categories with dynamically placed in smartfom. there how many items with in particular category print its self . how is it possible to printing .is it possible to print dynamic fields and window without changing driver program and structure .How to create dynamic window.
    any body knows reply me fast
    thanks in advance ,
    suresh

    Hi suresh,
        You can create all the windows, but if you go to specific window you will see different tabs like general attributes, output options and conditions. In that conditions tab, you can give condition. so based on that condition, that window will be printed.
    Dont forget to reward points if helpful.
    regards,
    Chandra.

  • How to create Dynamic Menu in 11g?

    Hello All,
    I am using JDeveloper/Adf 11g.
    Can you please tell me how to create Dynamic menu(means Menu will be created from table if we make any changes in table it will reflect to the Menu).
    Thanks.
    Neelmani Jaiswal
    (Madhav, Hayaghat)
    Edited by: Neelmani Jaiswal on Jan 6, 2009 11:01 AM
    Edited by: Neelmani Jaiswal on Jan 6, 2009 11:01 AM
    Edited by: Neelmani Jaiswal on Feb 3, 2009 8:46 AM

    Neelmani,
    How: write some code.
    The Web User Interface Developer's Guide for Oracle Application Development Framework will be helpful. Hint: you may want to read section 14.2 (especially 14.2.1, item 2, which talks about using iterators in a menu) OR section 17.5, which talks about creating menus to support page hierarchies.
    John

  • How To create Dynamic destination in blazeDS

    Hi,
    Can anyone tell me how to create dynamic destinations ?
    thnks

    hi,
    Basically you could read the destination and Endpoint from an xmlfile then feed the values as required, the following is a simple hardcoded setup but it doesn't take much to set vars in the creationcomplete event. At least this way you don't need baked in settings.
    <fx:Declarations>
    <s:Producer id="myProducer" destination="{myService}" acknowledge="myProducer_acknowledgeHandler(event)"/>
    <s:Consumer id="myConsumer" destination="{myService}" message="messageHandler(event)"/>
    </fx:Declarations>
    private var channelSet:ChannelSet;
    private var myService:String;
    protected function application1_creationCompleteHandler(event:FlexEvent):void
    channelSet = new ChannelSet();
    myService = "chat";
    //var channel:AMFChannel = new AMFChannel("my-polling-amf","http://localhost:8080/blazeds/messagebroker/amfpolling");
    var channel:AMFChannel = new AMFChannel("my-polling-amf","http://ezflex.net:8080/blazeds/messagebroker/amfpolling");
    channelSet.addChannel(channel);
    myProducer.channelSet=channelSet;
    myConsumer.channelSet=channelSet;

  • How to create dynamic variable in HANA

    Hello experts,
    Please help me on how to create dynamic variable in calculation view.
    Ex:  variable automatically should take YTD, or MTD values so that I can directly consume column in BW on hana or BO reporting.

    Hi ,
    Not sure on what are looking for. Have a look on the below blog once, if this is what you are looking out for:
    Applying YTD in SAP HANA with SAP BO Analysis Office
    Regards,
    Krishna Tangudu

Maybe you are looking for

  • Adober Reader suddenly won't open any PDF files (Mac)

    I had an old version, I downloaded the latest one, upgraded to the newest, even tried taking that one out and downloading an older version. It doesn't matter which version I seem to have, it won't open any pdf files from the web. I use a Mac, and Saf

  • Connecting with Printer

    Hi, We are using MII 12.0 on NW 2004s. We want to connect MII with Printer to get the data from printer. How to connect MII with printer. if through custom action , how to do it? Regards, Senthil

  • HT1904 How to cancel an automatic subscription

    I have joined a dating website and it's auto pay is through itunes. How do I cancel this?

  • How to read data and load into a table

    Hi, I have a client requirement as below. Client will send the xmlpayload, based on this xml I want to read the data and store it into a database table. Could you please let me know how to achieve this functionality. sample xmlpayload: <gesws:localeA

  • Delete a payment error

    I did not authorize a purchase and need to delete it from my account.