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 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need some help...i think it will be elementry..but it beats me.

    Guys,

    me is php coder. Java a bit above me head.

    Here is what I want..

    I want to be able to total up column of textboxs. The columns can have n number of rows (depending on a previous query).

    And if the total is less than a particular number then the submit button should apaer otherwise the submit button should remain invisible.

    an eg:

    Textbox that needs to be totaled ..there can be any number of rows each row iwll have just one text box that needs entering. default value=0

    For ($i=1;$i<something;$i++){
    <input type="textbox" size="5" name="AMT$i" size="12">
    }


    Totaling Box:

    <input id="TOTAL" name="TOTAL" size="12" readonly>

    The value in the totaling box should not exceed the value in this other table cell defined by XX.XX or Balance.

    <TD valign="top" align="left" width="0%" BGCOLOR="#FFFFFF" class="formdatafield">XX.XX<input type="hidden" value="XX.XX" name="balance">

    If the totaled value does exceed the "BALANCE" value then the submit button should not appear.

    Hope you guys can help me. I tried rehashing a code (just adding up the columns) and well failed rather spectacularly. Hence the posting.

    Thanks
    Apurva M
    Last edited by arcmax; 03-19-2005 at 11:42 AM.

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,466
    Thanks
    3
    Thanked 495 Times in 482 Posts
    got a bit confuses with you requirement but this may help

    PHP Code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
     <
    script language="JavaScript" type="text/javascript">
     <!--
     
    add=new Array();

     function 
    Add(){
      
    add[add.length]=document.getElementById('fred').cloneNode(true);
      
    add[add.length-1].id=add[add.length-1].id+add.length;
      
    add[add.length-1].value='New Text Box '+add.length;
      
    document.getElementsByTagName('BODY')[0].appendChild(add[add.length-1]);
      
    document.getElementById('fred').value=document.getElementsByTagName('INPUT').length-1;
      if (
    document.getElementsByTagName('INPUT').length>document.getElementById('hidden').value){
       
    document.getElementById('AddBut').style.visibility='hidden';
      }

     }


     
    //-->
     
    </script>

    </head>

    <body>

    max text boxes normally hidden <input id="hidden" value="10"><br>
    number of text boxes <input id="fred" value="A text box"><br>
    Text Box Total <input id="fred" value="A text box"><br>
    <input id="AddBut" type="button" name="" value="Add Text Box" onclick="javascript:Add();" ><br>
    </body>

    </html> 


  •  

    Posting Permissions

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