Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    17
    Thanks
    10
    Thanked 0 Times in 0 Posts

    How do I access the data in the textboxes in to collection object

    How do I access the data in the textbox in to a collection object.
    The collection object is in the bean.
    Please provide a solution


    Here is my code for creating the textbox and check box when a button is pressed.

    Code:
    <form name="frm" id="frm" action="../wait.html" method="post" >
    <div id="set1" style="position:absolute; left:65px;top:146px;" style = "hidden">
    <span id="output"></span>
    <input type="button" value="Add" onclick="Add()">
    <script type="text/javascript">
    function Add()
    {
    var checkbox=document.createElement('input');
    var inps=document.createElement('input');
    var label=document.createElement('label');
    var output=document.getElementById('output');
    checkbox.type='checkbox';
    label.innerHTML='Firstname';
    label.style.paddingRight='10px';
    inps.type='text';
    inps.name='textboxname';
    checkbox.name='checkname';
    output.appendChild(checkbox);
    output.appendChild(label);
    output.appendChild(inps);
    output.appendChild(document.createElement('br'));
    }
    </script>
    </div>
    </form>

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,858
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    The attribute which controls the text within a textbox is value
    ===
    Note: IE has a bug. It does not set properly the attribute "name" in DOM. You must use a workaround
    Code:
    //...
    var isIE=/*@cc_on!@*/false;//IE detector
    var checkbox, inps;
    if(isIE){
    checkbox=document.createElement('<input name="textboxname">');
    inps=document.createElement('<input name="checkname">');
    }
    else{
    checkbox=document.createElement('input');
    checkbox.name='checkname';
    inps=document.createElement('input');
    inps.name='textboxname';
    }
    //...the rest of the code
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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