Apply a classname to each of the form fields you want to add up, and
apply an ID to the field where you want the answer to appear. You can
do both of these steps using the Item / Extended menu option when you
have the form field selected.
Because you are using positioned elements for your form inputs, you
will have to be careful not to assign the same ID to the actual input
element as Freeway automatically generates for its wrapper DIV (the
HTML element used to position it on the page). You can ensure this by
clicking on the form field on your page, looking at the contents of
the Title field on the left-most tab, and the Name field on the Output
tab. Make sure these are different from one another.
Then, while the output field is still selected, choose Item /
Extended, and click on the New button. For your results field, add the
following pair:
- Name: id
- Value: whateverTheNameAttributeIs
You only need to follow this step for the output field. To humor IE’s
tender disposition, you should also be sure that the ID and Name
attribute (set on the Output tab of the Inspector) are the same.
For the other fields (the ones you want to add up) use this set of
options:
You won’t need to do anything funny with the IDs on these fields.
Finally, click on the pasteboard somewhere, apply Protaculous to the
page, choose prototype-packed as your library, and paste the following
into the top Function Body button found in the Actions palette:
new PeriodicalExecuter(function(pe){
var values = $$('.addme').pluck('value');
var total = 0;
values.each(function(num){
total += parseInt(num,10);
});
$('output').setValue(total)
},0.5);
In this example code, I have set the ID of my output field to
‘output’, but you should change that to read the same as whatever ID
you added to your field (in order to match the field’s name attribute).
What this does is look at the values of the form fields with the
classname ‘addme’ and adds their values together and writes the sum
into the output field. It does so once every half-second, so your form
will be really responsive to changes.
Walter
On Oct 4, 2010, at 8:31 AM, TomP wrote:
Here is the form page. What I want is
actually just a running total (Totalkosten) when one’s
choose “messetheke 1” plus "messetheke " etc.
Thats all …
variorent.ch - falttheke - messetheke - vermietung - mietformular
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options