CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Calculate a field value in an editable grid

Print topic Send  topic

Author Message
saseow

Posts: 744
Posted: 10/02/2008, 11:14 AM

I have two editable grids in a page:
Grid1 has a field called 'number_of_teams'
Grid2 has two fields 'number_team' and 'total_owned'

All I want to do is calculate total_owned = number_of_teams * number_team.

The user does not have to see the result so total_owned is hidden. All fields are connected to tables. This is what I have tried, with no luck!

Client Side On Submit:
function calc_total() {
document.getElementById('total_owned ').value = document.getElementById('number_of_teams ').value * document.getElementById('number_team').value;
}


This is what I have tried on Server side Before Show and various others:

$db = new clsDBhockey_stats();
$sql="SELECT league_setup.number_of_teams FROM league_setup WHERE league_setup.user_id=" .CCGetUserID();
$db->query($sql);
$teams= $db->f("number_of_teams");
echo $teams;
$Container->total_owned->SetValue(($Container->number_team->GetValue()*$teams));
$db->close();


Also Tried:

$db = new clsDBhockey_stats();
$sql="UPDATE league_info INNER JOIN league_setup ON league_info.user_id = league_setup.user_id SET league_info.total_owned = league_info.number_team*league_setup.number_of_teams UPDATE league_info INNER JOIN league_setup ON league_info.user_id = league_setup.user_id SET league_info.total_owned = league_info.number_team*league_setup.number_of_teams where user_id=" .CCGetUserID();;
$db->query($sql);
$db->close();

Nothing works. Must be doing something stupid.

Any ideas would be greatly appreciated!

Regards,

Trevor
View profile  Send private message
jjrjr1


Posts: 942
Posted: 10/02/2008, 11:45 AM

Hi

On your client side code change it to a client side "On Load"

I think on submit might be too late.

Let me know.


_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
saseow

Posts: 744
Posted: 10/02/2008, 12:55 PM

Thanks for the reply but no luck. Put the jscript in the On Load event and same thing. The field is not updated.

Regards,

Trevor
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.