Form with item counter or cost

Is it possible - or is there an action – to create a form where selectet items generate a total cost estimate? (Not an external shop solution - within the form page.)


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Can you show an example page which has this form on it? The short answer is yes, it can be done using JavaScript, and the only thing we would need to see is how your users choose their quantities.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Here we go … I’d like to create it this way

http://www.heatball.de/bestellung.php


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Here we go … I’d like to create it this way

http://www.heatball.de/bestellung.php

Interesting - that calculator doesn’t work when you translate the page from German to English in FF.

I am assuming that it is to with the ‘,’ as a number separator in German?

Here is one that Walter made earlier http://www.deltadzine.net/test/calculator.html

The principle is similar to what you want - all the calculation is in the JS

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And another more like what you want http://www.deltadesign.co/odds/calculator.html

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

D-Dave

Thank you. I owe you a beer. Or two ;o)


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Let us see your page once you have done it

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Dave, sorry, on more question: how can I
use this one? Can I download and modify it?

http://www.deltadesign.co/odds/calculator.html


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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 …


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

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:

  • Name: class
  • Value: addme

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

Minor issue with the previous version of this – it would report ‘NaN’
as the value for the total until you actually entered something in the
fields. Here’s a corrected version, which tests for value greater than
0 before performing the addition.

new PeriodicalExecuter(function(pe){
	var values = $$('.addme').pluck('value');
	var total = 0;
	values.each(function(num){
		if(num > 0)
		total += parseInt(num,10);
	});
	$('output').setValue(total)
},0.5);

Walter

On Oct 4, 2010, at 9:07 AM, Walter Lee Davis wrote:

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:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you Walt. I really appreciate your help. The only thing is: it does’nt work. Iam pretty shure that this is on me … Maybe I’ll find it out where the hook is …


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Here’s a working example page: untitled

Walter

On Oct 4, 2010, at 11:14 AM, TomP wrote:

Thank you Walt. I really appreciate your help. The only thing is: it
does’nt work. Iam pretty shure that this is on me … Maybe I’ll find
it out where the hook is …


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

Post a link, and one of us can look in Firebug and see what the error
looks like.

Walter

On Oct 4, 2010, at 11:14 AM, TomP wrote:

Thank you Walt. I really appreciate your help. The only thing is: it
does’nt work. Iam pretty shure that this is on me … Maybe I’ll find
it out where the hook is …


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

Hi Tom here is the working example http://www.deltadesign.co/tomp/variorent.ch-fal.html

Most of the credit here goes to Walter because this was based entirely on his work - I have only added/modified it and incorporated his addition module.

Thanks Walter

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Just to make it clear: what Dave did for me was unbelivable!
He spent hours to clean that from and then he sent me an
emal 03.00 in the morning!!

It is on me to say:

Thank you Dave.
Thank you Walt.

One high 5 goes to Scotland.
One high 5 goes to the US.

Thomas


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options