Results 1 to 9 of 9
  1. #1
    mailvkjain is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Exclamation Adding auto complete field in form

    Hi I have a form , which has three fields. I am looking that having an option where once user enter all three fields , new pair of same fields aromatically or dynamically get generated for user to enter next values.

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Adding auto complete field in form

    I would think you could use a keyboard listener and once all three fields have content, then add two more to the JPanel.

  3. #3
    mailvkjain is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Adding auto complete field in form

    Thanks for the reply. Is there any code example which is available for me to analyse?

  4. #4
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Adding auto complete field in form

    Depends on where you are stuck. Do you know how to use a KeyListener?

  5. #5
    mailvkjain is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Adding auto complete field in form

    I was just seeing a demo on oracle site. But honestly im new to java. im not stuck yet. I am yet to start. What i have described is the problem statement that i have.

  6. #6
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default Re: Adding auto complete field in form

    You didn't answer my question.

  7. #7
    mailvkjain is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Adding auto complete field in form

    @quad64bit I really do not know how to use keylistener

  8. #8
    mailvkjain is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Adding auto complete field in form

    This is some code that i have found


    <html>
    <head>
    <title></title>
    <script language="javascript">
    fields = 0;
    function addInput() {
    if (fields != 10) {
    document.getElementById('text').innerHTML += "<input type='input' value='' name='field[]' /><br />";
    fields += 1;
    } else {
    document.getElementById('text').innerHTML += "<br />Only 10 upload fields allowed.";
    document.form.add.disabled=true;
    }
    }
    </script>
    </head>
    <body>
    <form name="form" action="form.php" method="post">
    <input type="button" onclick="addInput()" name="add" value="Add input field" />

    <div id="text">

    </div>

    <br />
    <input type="submit" value="Submit" />
    </form>
    </body>
    </html>


    issues with this is user has to manually click on add input field. I want this to be dynamic. I also want to add three fields at a time.

  9. #9
    mailvkjain is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Adding auto complete field in form

    Now i have three fields. I just want to make it dynamic.
    <html>
    <head>
    <title></title>
    <script language="javascript">
    fields = 0;
    function addInput() {
    if (fields != 10) {
    document.getElementById('text').innerHTML += "<input type='input' value='' name='field[]' /><br />" ;
    document.getElementById('text').innerHTML += "<input type='input' value='' name='field[]' /><br />" ;
    document.getElementById('text').innerHTML += "<input type='input' value='' name='field[]' /><br />" ;
    fields += 1;
    } else {
    document.getElementById('text').innerHTML += "<br />Only 10 upload fields allowed.";
    document.form.add.disabled=true;
    }
    }
    </script>
    </head>
    <body>
    <form name="form" action="form.php" method="post">
    <input type="button" onclick="addInput()" name="add" value="Add input field" />

    <div id="text">

    </div>

    <br />
    <input type="submit" value="Submit" />
    </form>
    </body>
    </html>

    as in i do not need click button

Similar Threads

  1. Replies: 1
    Last Post: 03-22-2010, 09:03 AM
  2. Auto Complete - Please Assit
    By chellede in forum New To Java
    Replies: 1
    Last Post: 01-29-2010, 07:02 PM
  3. auto complete textarea
    By praba@spiretek.in in forum AWT / Swing
    Replies: 0
    Last Post: 11-16-2009, 07:06 AM
  4. Auto-complete/Auto-fix for custom statement
    By dark_cybernetics in forum Eclipse
    Replies: 0
    Last Post: 08-19-2008, 11:19 AM
  5. [SOLVED] Auto complete Text.
    By smartsubroto in forum New To Java
    Replies: 9
    Last Post: 06-27-2008, 04:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •