infobih
Posts: 58
|
| Posted: 07/03/2008, 2:53 PM |
|
Hi all
I have one grid which displays name + price in each row. I have added checkbox to row.
I have created Label Field below Grid. I want to calculate this Label Filed each time when each Checkbox in Grid is clicked to display Total Price
How can i do that??
please help
Thanks
|
 |
 |
datadoit
|
| Posted: 07/03/2008, 9:05 PM |
|
Given that your editable grid is named MyGrid, and that your price
fields are called Amount and are text boxes, and that your Total field
is a text box within the confines of your form, in your HTML put this:
<script language="Javascript">
function TallyTotal()
{
initMyGridElements();
var Total = 0;
for (var j = 0; j < MyGridElements.length-MyGridEmptyRows; j++) {
if (MyGridElements[j][MyGridDeleteControl].checked) {
Total = Total + eval(MyGridElements[j][MyGridAmountID].value);
}
}
document.MyGrid.TotalBox.value = Total;
}
</script>
For your delete checkbox, add Client -> OnClick -> Custom Code:
TallyTotal();
See this excellent post on how to get values of editable grid rows:
http://forums.codecharge.com/posts.php?post_id=60507
|
|
|
 |
infobih
Posts: 58
|
| Posted: 07/06/2008, 10:24 AM |
|
Hi, thanks for answer. I am not familiar with JavaScript. I am willing to pay someone to create one example for me.
Here is example webpage, how should it works:
http://www.autobooker.fr/c1-pack-hdi-55-3p.7.184552458.html
In section "Equipment" are checkboxes with prices o select or deselect.
Dependng of chckbox cheked, in field "TOTAL" display calculated value for sum of cheked checkboxes.
if anyone can do it for me, please reply
Thank you
|
 |
 |
infobih
Posts: 58
|
| Posted: 07/07/2008, 11:29 AM |
|
Any Freelancer available?
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/07/2008, 2:24 PM |
|
The Datadoit method works, just build example, method needs some extra work though.
@DD, to mimic grid, amount textboxes set to read only, TotalBox= textbox same read-only set.
Submit Button set to No Action else delete will be executed.
Can write tutorial based on store_product table from Internet Example.
Incorporating DD's method.
With comment on how to alter for your situation.
If you supply table details (name, fields, key).
Can do example (zipped) too, but leave first take to Datadoit......
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
datadoit
|
| Posted: 07/09/2008, 8:10 AM |
|
Go for it Walter. I have no interest in freelancing at this time.
|
|
|
 |
|