CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to programatically update a field on a record form

Print topic Send  topic

Author Message
Gary Finlay
Posted: 01/25/2005, 7:55 AM

I have a record form with (among others) three fields...

Cost per item (Label - primed with a value in "before show" event)
Quantity (Textbox)
Total (Label)

How would I get Total to show CostxQuantity after the user enters a number
in Quantity?

TIA
Gary

matheus

Posts: 386
Posted: 01/25/2005, 9:00 AM

He enters a number and click a button (make a submit) or a link?

If wanna without click a button or link it must be javascript and calculate always a key is pressed.

If wanna button or link is easy make a refresh and calculate anyway.
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
Gary Finlay
Posted: 01/25/2005, 10:24 AM

Matheus,

Can you explain how to do this please...

>> If wanna button or link is easy make a refresh and calculate anyway.

Thanks
Gary
matheus

Posts: 386
Posted: 01/25/2005, 10:52 AM

with link could do submit.

in before show from total make a custom code.

getting the value from label per item multiply quantity.
_________________
Matheus Trevizan

Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br
View profile  Send private message
Gary Finlay
Posted: 01/25/2005, 11:11 AM

If I add a link/button to do a submit will that not add the record to the
table? Do I have to reget the record? How do I change the record form to
Update then?

Gary
peterr


Posts: 5971
Posted: 01/25/2005, 11:42 AM

Maybe take a look at this CCS example:
http://examples.codecharge.com/ExamplePack/OrderEntry/O....php?order_id=3

It performs exactly the same function that you asked about: calculates total as cost x quantity.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
aakici


Posts: 49
Posted: 01/25/2005, 2:50 PM

You can do this various ways depending on your forms type (record form, grid?).

First, click on the quantity textbox. In the events part of properties window, click on the On Change (Client options) and click on the +. Then click on the Add Code. Then write code for you similar to this code :

document.YourFormName.total.value = document.YourFormName.quantity.value * document.YourFormName.CostPerItem.value;

But if your form is a grid code is more complex. Then your code must be similar to this :

var Summ=0;

for(var i = 0; i < Elements.length; i++)
{
Summ = YourFormNameElements[YourFormNamequantityID].value *
YourFormNameElements[YourFormNameCostPerItemID].value;
}
document.YourFormName.total.value = summ;


_________________
Regards,
M.Alpaslan AKICI
View profile  Send private message
Gary Finlay
Posted: 01/25/2005, 6:14 PM

AAkici, thank you for your help. My form name is bookings and the three
fields are called...

FriBBQuantity
FriBBCost
FriBBTotal

I have entered this code...
document.bookings.FriBBTotal.value = document.bookings.FriBBQuantity.value *
document.bookings.FriBBCost.value;

into the "On Change (Client)" of FriBBQuantity.

When I enter a value in FriBBQuantity and press tab nothing happens - no
value appears in FriBBTotal. I do have a value in FriBBCost.

Even if I change the code to...
document.bookings.FriBBTotal.value = 3;
nothing happens.

Any ideas?

Regards
Gary


"aakici" <aakici@forum.codecharge> wrote in message
news:541f6cd1d0185c@news.codecharge.com...
> You can do this various ways depending on your forms type (record form,
> grid?).
>
> First, click on the quantity textbox. In the events part of properties
> window,
> click on the On Change (Client options) and click on the +. Then click on
> the
> Add Code. Then write code for you similar to this code :
>
> document.YourFormName.total.value = document.YourFormName.quantity.value *
> document.YourFormName.CostPerItem.value;
>
> But if your form is a grid code is more complex. Then your code must be
> similar
> to this :
>
> var Summ=0;
>
> for(var i = 0; i < Elements.length; i++)
> {
> Summ = YourFormNameElements[YourFormNamequantityID].value *
> YourFormNameElements[YourFormNameCostPerItemID].value;
> }
> document.YourFormName.total.value = summ;
>
>
> _________________
> Regards,
> M.Alpaslan AKICI
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Gary Finlay
Posted: 01/25/2005, 6:24 PM

I don't believe it! I was finishing for the night, closed ccs, did a
backup, decided to have another go started ccs and it worked first time!!

I made no change to the code at all but it's working!!

Aakici, thank you very much for your help.

Regards
Gary


"Gary Finlay" <throw.away3@ntlworld.com> wrote in message
news:ct6udv$eeg$1@news.codecharge.com...
> AAkici, thank you for your help. My form name is bookings and the three
> fields are called...
>
> FriBBQuantity
> FriBBCost
> FriBBTotal
>
> I have entered this code...
> document.bookings.FriBBTotal.value = document.bookings.FriBBQuantity.value
> * document.bookings.FriBBCost.value;
>
> into the "On Change (Client)" of FriBBQuantity.
>
> When I enter a value in FriBBQuantity and press tab nothing happens - no
> value appears in FriBBTotal. I do have a value in FriBBCost.
>
> Even if I change the code to...
> document.bookings.FriBBTotal.value = 3;
> nothing happens.
>
> Any ideas?
>
> Regards
> Gary
>
>
> "aakici" <aakici@forum.codecharge> wrote in message
>news:541f6cd1d0185c@news.codecharge.com...
>> You can do this various ways depending on your forms type (record form,
>> grid?).
>>
>> First, click on the quantity textbox. In the events part of properties
>> window,
>> click on the On Change (Client options) and click on the +. Then click on
>> the
>> Add Code. Then write code for you similar to this code :
>>
>> document.YourFormName.total.value = document.YourFormName.quantity.value
>> *
>> document.YourFormName.CostPerItem.value;
>>
>> But if your form is a grid code is more complex. Then your code must be
>> similar
>> to this :
>>
>> var Summ=0;
>>
>> for(var i = 0; i < Elements.length; i++)
>> {
>> Summ = YourFormNameElements[YourFormNamequantityID].value *
>> YourFormNameElements[YourFormNameCostPerItemID].value;
>> }
>> document.YourFormName.total.value = summ;
>>
>>
>> _________________
>> Regards,
>> M.Alpaslan AKICI
>> ---------------------------------------
>> Sent from YesSoftware forum
>> http://forums.codecharge.com/
>>
>
>

aakici


Posts: 49
Posted: 01/26/2005, 4:55 PM

:-) I am pleased to help you.
_________________
Regards,
M.Alpaslan AKICI
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.