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