Urgent! How to add another text field using Servlet

Hi all,
I'm using Java Servlet to create a submit page. I want to let users to submit their products and as many as they like.
What I made several chechboxs of common products on the first part of the page, so that users can simply select from these common products. If they have more to submit, they can click a "Add" button, then another textfield is supposed to appear in the same page below the "Add" button and user can type in, then if they have more, they click "Add", another textfiled should apprear under the first added textfield, so on and so on. After finishing type in all their products, they can click "submit" button to submit to the database.
I want all the inputed data stay in the same page when user add more and more, so that they can alwasy see and change before submit. I had problem to detect the "Add" button and add new textfield while keeping all the data user has already inputed. How can I do this?
Tons of thanks!
Victor

Hi
I normally use "hidden" tables for something like this. To accomplish the effect I use JavaScript and a stylesheet. Remember once the servlet sent the page to the browser, it can't interact with it anymore - you'll have to use client side script - which off course you can sent as part of your servlet output :-). I'm including some code that will get you on your way...
Style Sheet Code:.hide {display:none};
.show {display:block};
Java Script Code:var current = 0;
function showMore() {
  if (current < 5) {
    current++;
    switch (current) {
      case 2:
        document.getElementById("showme2").style.display = "block";
        break;
      case 3:
        document.getElementById("showme3").style.display = "block";
        break;
      case 4:
        document.getElementById("showme4").style.display = "block";
        break;
      case 5:
        document.getElementById("showme5").style.display = "block";
        break;
function showLess() {
  if (current > 1) {
    switch (current) {
      case 2:
        document.getElementById("showme2").style.display = "none";
        document.forms[0].term[1].value = "";
        break;
      case 3:
        document.getElementById("showme3").style.display = "none";
        document.forms[0].term[2].value = "";
        break;
      case 4:
        document.getElementById("showme4").style.display = "none";
        document.forms[0].term[3].value = "";
        break;
      case 5:
        document.getElementById("showme5").style.display = "none";
        document.forms[0].term[4].value = "";
        break;
    current--;
Extract from JSP page (easy to convert to normal servlet code):<!-- first row allways visible -->
<table id="showme1" cellpadding="3" cellspacing="0" class="show">
     <tr><td><input type="text" name="someitem"></td></tr>
</table>
<!-- hide the rest for now -->
<% for (int i = 2; i < 6; i++) { %>
<table id="showme<%=i%>" cellpadding="3" cellspacing="0" class="hide">
     <tr><td><input type="text" name="someitem"></td></tr>
</table>
<% } %>There are other ways to do the JavaScript, but the code above is cross-browser :-). You'll see with the switch statement in the JavaScript, that there is a limit to the rows that gets displayed - adjust as you please, just remember to also update the loop that generates the tables. Also note that each text field has the same name! The result of this is that an array of these fields are submitted, so you're recieving servlet will need to loop through the array basically take appropriate action on the fields that don't contain an empty string. Something like:String[] items = request.getParameterValues("someitem");
for (int i = 0; i < items.length; i++) {
    if (!items.trim().equals("")) {
//do something

Similar Messages

  • How to add new text field in standard report

    how to add new text field in standard report?

    Hi,
    I presume you are talking about a report display in ALV and u wish to add a column to it .
    If it is a global requirement ,as in table being used there in ALV can be modified, then you can append the table and the system should pick up the same automatically from there.
    Otherwise , you can make a Z program . Modify the catalog being used in ALV.
    Regards,
    Shweta

  • How to add new "text" field in GL item fast entry?

    Hi Gurus,
    Is that possible to add "text" column or field in GL item fast entry. For example, if i go to Txn F-04, i enter all the details then i go to: "Goto>GL item fast entry (shift+F8). Now you will see layout (GL item fast entry). So back to my question before, is that possible to add new field or column (text field) in this layout? If the answer is Yes, appreciate Gurus help and guide me in configuration, if any.
    Thank you
    Regards,
    Nazrul

    Hi Sreehari Annavaram,
    Thank you for your kind reply. Based on the answer from the link you have given me (as per below quote), there's no "DEM03" in my selection screen. We only have SAP01, SAP02 and GL001 (customised layout). That's why i had created new customised layout GL002 and try to add the "text" field in layout as per my first question. But system still won't allow it.
    *"In F-02 under editing option screen screen templates and line layout variant for document entry will be there in that
    GL accounts items for fast entry select DEM03 u will get the text item"*
    Appreciate help.
    Thank you
    Regards,
    Nazrul

  • How to add another Segment field in OBC4

    Dear Experts,
    OBC4 -> select Comp. Code -> field Status Group -> select Field St. Grp -> Duuble click on Field St. Grp
    I have a requirement to make Business Place/secn field Mandatory where ever it is used in transaction F-43 , F-02 , F-48 .
    So for this am going through OBC4 . But there (Under Field status Grp.) am not getting any field named as Business Place . There exists a field Business Area . But Business Area and Business Place both are different .
    So Is it possible to add another segments named as Business Place/secn  there with 3 options Supress , Req. Entry , Opt. Entry . So that i can change it to Mandatory .
    Thanks in Advance
    Jack

    Hi,
    Check this sample process
    To get custom fields on IDOC you need to add custom segment on IDOC and for that you have to create a extension IDOC with reference to Basic IDOC.
    You can do that as explain below.
    Here for example you have basic idoc ORDERS05 and you want to add additional segments at header level - ZE1EDK01 and line item level ZE1EDP01
    1. TCode - WE31 : Create custom segments ZE1EDK01 and ZE1EDP01 with the fields you want and release these segments.
    2. TCode - WE30 : Create extension IDOC
    In WE20 enter extension IDOC name - ZORDERS05, select "Extension" option and hit "create" button. When it gives pop-up, select "create new" and enterd linked basis type as "ORDERS05". Enter proper description and save.
    3. On the next screen of WE30, select the segment under which you want to add your additional segment. Save everything.
    4. TCode - WE82. Here you link extension idoc to basic idoc and message type.
    Go into change mode. Hit "New entries button" Enter Message type = "ORDERS", basic type = "ORDERS05" and extension type = "ZORDERS05".
    Regards,
    Satish

  • How to validate an text field item using javascript for numbers only.

    hi,
    how to validate an text field item using javascript for numbers only.please help me on this urgent
    please mail me solun if posible on [email protected]

    Hi,
    Page HTML header
    <script>
    function onlyNum(evt) {
      // Usage: onKeyPress="return onlyNum(event)"
      evt = (evt) ? evt : window.event;
      var charCode = (evt.which) ? evt.which : evt.keyCode;
      if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        var status = 'This field accepts numbers only!';
        alert(status);
        return false;
      var status = '';
      return true;
    </script>Item HTML Form Element Attributes
    onKeyPress="return onlyNum(event)"Br,Jari

  • How to clear a text field when another is selected

    Ok I'm new at this, so please forgive me...
    I have a form that has the following
    a text field that is a dollar amount (eg @1,000)
    another text field that has the cents value (eg .00)
    and then
    a text field that has a % amount (eg 100%)
    I only won't the user to fill in one of the options,
    either the dollar and cents amount
    OR the % amount.
    I don't won't them to be able to enter text into both options and once they click on one option I want the other to clear if there is any text entered into that field.
    I hope that makes sense, any helpful information would be greatly appreciated!!

    Sorry..I figured it out. Thanks.

  • Hi All ,How to add a new  field for MEDRUCK if we havea ZMEDRUCK

    Hi All ,
            How to add a new  field for MEDRUCK if we have a ZMEDRUCK
    Req: If I want to add a new field for the following text editor line :
    IN MAIN WINDOW > TEXT EDITOR> SERCH FOR TOTAL_AMOUNT-->
    In that we will have
    &ekko-waers&    &komkfkwrt&
    (currency)       (numerics)
    Pls send the Code to make these changes .Pls its urgent
    Thanks&Regards.
    Bharat.

    Hi
    If that field which you wants to add is available in one of the structures like EKKO,EKPO then you can add that field just beside the other fields
    If that field is not there in the any of the structures then you can define a variable using define command
    /: DEFINE  &VAR&
    / &VAR&  = <some value>
    or you can write subroutines to fetch the data from outside tables and can use those fields data in the script
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to add an input field in the web UI of CRM 2007

    Hi everybody.
    I want add an Input field in the Web UI Screen. How it is possible.
    I want get the information with detailed descriptions if possible with screen shorts.
    What type of methods it will be generated and what are the code we entered in those methods.
    Take according to any example. But with detailed description.
    I am new for the CRM 2007. So, please give the screen shorts with proper data.
    Not only adding the field. If any data i entered in the adding field then that will be stored in the tables otherwise no use by adding the field.
    So, Can anybody please send a proper information according to this.
    Here another one How to Add our own table (Ztable) field in the Web UI Screen.
    How to add the same field in the BOL.
    Please expalin about those concepts with full of screen shorts messages.
    Thank You.
    Regards,
    Krishna.

    If you want to add extra standard fields (like one you mentioned), you can use Component Workbench and Copy the configuration and create your own configuration and make the "Available Fields" appear there.
    If the standrd field is not available, you can Add Context Node using wizard and make it visible.
    If its a custom field (a new one); you will have to use EEWB and add the fields and then make it visible in the UI using Component Workbench.
    Regards,
    Alin

  • How to Add a new Field in the Web UI

    In CRM.
    I want add a fields. How it is Possible.
    In WebUI after login. Select BP_SRV_MAIN.
    Then Select Manage Reports.
    Select New Entry.
    Porivide Program Name.
                Short Description.
                Select Service from Drop Down.
    Select Tables Radio Button.
    Press Next.
    It display all available FIelds.
    But i want add another some fields into this. How it is possible.
    Here i am getting   Component Name as  CRMCMP_OR_DTWIZ.
                                View Name as    RptColumns.
    So How can i get more fields like ObjectID of CRMD_ORDERADM_H.
    Can you please explain me about this. If possible with Screen Shorts.
    Thank You.
    B. Krishna

    If you want to add extra standard fields (like one you mentioned), you can use Component Workbench and Copy the configuration and create your own configuration and make the "Available Fields" appear there.
    If the standrd field is not available, you can Add Context Node using wizard and make it visible.
    If its a custom field (a new one); you will have to use EEWB and add the fields and then make it visible in the UI using Component Workbench.
    Regards,
    Alin

  • How to add another Chapter Page for more then 6 chapters & add right arrow?

    Hello,
    I created a project via the Magic iDVD option and it worked great and added multiple chapter pages for more then 6 chapters. Now, I manually added a submeno off of main and added 6 chapters but I need multiple pages since I have 40 chapters... I can't figure out how to add another chapter page and create a RIGHT ARROW navigation button for the next pages...
    I also looked at the map view and see that on the working pages there is page connected to page... I also cannot find a way to add a page connected vi map view...
    I have searched the forum but none of the answers were clear on how to do this... any help would be appreciated...
    Thanks! T.

    Adding the submenu is easy...making the button for it a "right arrow" is not.
    You can keep adding submenus to other submemus by navigating to the appropriate menu and then choose the "add submenu" command from the iDVD project menu. This can be done in either normal or map view.
    However, this creates a "folder" button, (or other things in some themes) not a right arrow. I agree it should be a choice! My 2nd best solution is to chage the folder button to a "text only button" and label it "More Chapters > >"
    Another solution (3rd best??) is to use command-shift-4 when you are one one of your other menus that DOES have a right arrow, and take a mini picture of the arrow. Then choose one of the oval menu buttons on the button pane, and drag this tiny picture onto the button. Re-size it to make it close to the same size as your other buttons. It will have a funny edge on it from the button style, but it will look like a right arrow.
    John B

  • How to add standard text in PO and how it is maintained ?

    How to add standard text (paragraph) in PO and how it is maintained ?

    Hi
    Please go through this document.which has a step by step
    Working with Frequently Used Texts
    Use
    You can copy texts from various sources to create PO texts:
    Standard texts
    Certain standard texts are supplied with the system and can be assigned to a purchasing document in Customizing.
    The content of some standard texts is predefined by your system administrator.
    You can also create standard texts yourself and copy them into purchasing documents.
    Master records
    Database fields
    Activities
    Creating Standard Texts
    You can create your own standard texts via Tools ® SAPscript ® Standard text.
    Inserting Standard Texts
    You can insert your standard text on the long text screen via Insert ® Text ® Standard.
    For more information, refer to the Basis documentation under BC Word Processing with the SAPscript Editor:  Including Texts.
    You can display the print preview via Text ® Print ® Print preview.
    Inserting Texts from the Master Record
    There are three ways of linking texts from a master record with a purchasing document. The relevant settings are made for each text type in Customizing for Purchasing. The indicator in the status column shows the nature of the linkage.
    Option                                              Indicator in status column
    The text is copied:               
    It is then independent of the text                 None
    in the master record. Changes to
    the text in the material master record
    have no influence on the text in the document.
    The text is displayed only:
    It cannot be adopted.                                          N
    The text is offered for copying:
    It can be copied via Header or Item ® Texts ® Adopt text. (In requisitions: Goto ® Texts ® Adopt text.) Changes made in the master record will also be adopted in the document until such time as you copy the text.
    Inserting Texts from Database Fields
    You can include the content of a database field at any point in the text on the long text screen. A value specific to the relevant document is displayed in the printed document.
    Choose Insert ® Symbols ® Program symbols.
    Choose DDIC fields.
    Search for the relevant table/structure (in the case of PO items, this is EKPO) and then choose ENTER .
    Choose the relevant table field.
    Choose Text ® Print preview to see the print preview.
    Reward if useful
    Aasif

  • Text input box to show in another text field

    Hello,
    I have a text input box (Text1) showing during a certain label on the stage.  On another label there is another text field (Text2) that is not input-able.  This second text field (Text2) should show whatever the user has inputted in the first text input field (Text1).
    Both of these elements are not symbols and right now they are both text elements.
    Does anyone know how to do this?
    Thanks,
    ~iana~

    I believe the inputField is set accordingly.  And including your reply, here's what I've got on my stage:
    sym.$("Name").attr('contentEditable', true);
    var inputValue = sym.$("Name").value;
    // other text
    sym.$("Signature").html(inputValue);
    Thus far, this does not work. "Name" field is Text1 (inputField) and the "Signature" is Text2 (text box)
    I'm new to all this so I've prob got something wrong...do you know what I should adjust?

  • How to add standard text in smartforms?

    Hi friends,
    How to add standard text in smartforms ?
    points rewarded soon
    Regards
    RH

    Creating the Standard Text:
    Go to SO10
    1. Enter Text Name.  For example, ZABC
    2. Text ID ST
    3. Language EN
    Click on Create.
    And enter the Required Information and save.
    To include a Standard text in SmartForm.
    Follow the steps below:
    1. Create a text node in the window.
    2. Under general attributes select "Include text" as Type.
    3. Specify the fields under Text.
    Text Name ZABC
    Text Object TEXT
    Text ID ST
    Language EN.
    Hope it helps.
    Regards.

  • How to add a text box in the layout (View)

    How to add a text box in the layout (View)

    Hi.
    Right Click in the RootUIElement container.
    Click Insert Element.
    Give Name: Input
    Type : Input Field.
    Press Enter.
    Regards
    Bala.

  • How to add a customer field or extn coll in the tab1&2&3..of a UDO doc?

    Hi Experts,
    Does anybody know how to add a customer field or extn collection in the unused  tabs like tab1&2...in a UDO document?
    Thanks for your reply in advance.
    Thanks & Regards,
    David

    Hi Subhasini - <br><br>
    It seems you have discovered that adding an extension field to the Project Suppliers collection is not possible; many of the collections in E-Sourcing do not support extensions and, even when they do, typically, the table view of the data cannot be changed to show the extension value (it would only show on a "details" page, for example.<br><br>
    The solution that you have proposed may work, although I think there is a slight mistake in your logic. I believe you are saying that the script would take data from the newly created extension collection and populate data in the out-of-the-box vendor collection. <br><br>
    In thinking about your solution, I believe the benefit is that any logic and reporting based on the standard collection continues to function correctly (e.g., creating an RFx from the Project will use the out-of-the-box vendor collection).<br><br>
    That being said, I generally am reluctant to do a "replace" of a standard collection with an extension collection as you propose. My recommendation is that you challenge the customer on the importance of this requirement. For example, could the code be maintained on the vendor record? Why is it maintained in Projects? If it is maintained in the vendor record, could you just populate a read only collection the Projects that shows the vendor and code? Could a report be written that can be launched from within the Project to show the values? How does the customer intend to use this field? Could the display name of the vendor object be the right place for it?<br><br>
    I hope these ideas are helpful.<br><br>
    Regards,<br><br>
    Rob<br><br>

Maybe you are looking for

  • Administrator Bios Password won't work on HP 4420s XT940UT#ABA Windows 7 64 Bit

    Someone please help me with this!! I bought this laptop from a friend (have a receipt) who sold it to me because the screen was cracked and all spidered out when you turned it on. Well everywhere he went to ask about getting the screen fixed it was v

  • How do i know if my samsung tv is compatible with my macbook pro?

    I have an LCD samsung TV, the model is LE40R86BDX when i connect my macbook pro by mini displayport HDMI adapter on my samsung tv i can't see the monitor of my macbook pro, and tell me : no signal! help me!!!!

  • Who can I do this?

    Ok I am helping a friend with a website for a local ski shop to sell online. I have done dynamic sites before and have managed to figure things out most of the time by searching....but I am really butting my head against the wall. Here is what I need

  • All my purchases are deleted!?!? HELP!?!?

    Hello, I recently was syncing my iPhone with my computer, and we have purchased many songs. Not to mention it all adds up. For some reason, and I don't know why, I went on iTunes to sync my iPhone with the computer, and all my songs were GONE! All of

  • Problems with alignment when printing a mail merge envelope in Word 2013

    I am using Mail Merge in Word 2013 to print approximately 100 envelopes, size #10 landscape (9.5" x 4.12"), with a return and recipient address.  But when it goes to print, the alignment is completely wrong: it prints the recipient address at the "to