...

View Full Version : Need some help...i think it will be elementry..but it beats me.



arcmax
03-19-2005, 12:39 PM
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

vwphillips
03-19-2005, 01:08 PM
got a bit confuses with you requirement but this may help




<!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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum