[Pro] Price estimate form

I have a client that would like to have a form that would calculate an estimate for his clients. Ideally it would pop-up a window with the price estimate after the form has been submitted. This way he will collect the client’s information when they see the estimate. I have never made a form that can calculate a total before so I’m not really sure where to start. I’ve read through the reference guide and a lot of posts, but haven’t seen what I’m looking for. This page has basically what he is looking for, but instead of having the total show up right away, the client would enter an email address and then hit submit to see the estimate. http://www.watson-window-washing.com/instant-quote/?f=1

If anyone might be able to give a little insight as to an action that might help or just a little guidance, I’d appreciate it.

Thanks!


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

If you want to gather the e-mail address, then I would recommend that you do this on the server, rather than on the browser (where an Action could help). If you use the PHP Feedback Form, you can create a basic form handler very easily in Freeway, but in order to add the estimating part to it, you will need to modify that handler to add the specific details that your products require.

What I would do first is get the form set up with PHPFF, and get it to the point where it sends you an e-mail with the person’s address and the specific things that they requested a quote for. Once you have that working (and Tim provides a great manual and lots of support for that Action, so I have every confidence you can get that part done) then we can look at the generated code, find the part where it is looping over the form elements, and “teach” it to handle your quotes.

The example you show is using JavaScript to modify the page, and that’s another great way to go here, but it will require programming at the Freeway side (and no Actions can really make this easier) besides the PHP (server) side. See if you can make it work in PHP first.

Walter

On May 22, 2012, at 2:11 PM, Brian Yun wrote:

I have a client that would like to have a form that would calculate an estimate for his clients. Ideally it would pop-up a window with the price estimate after the form has been submitted. This way he will collect the client’s information when they see the estimate. I have never made a form that can calculate a total before so I’m not really sure where to start. I’ve read through the reference guide and a lot of posts, but haven’t seen what I’m looking for. This page has basically what he is looking for, but instead of having the total show up right away, the client would enter an email address and then hit submit to see the estimate. http://www.watson-window-washing.com/instant-quote/?f=1

If anyone might be able to give a little insight as to an action that might help or just a little guidance, I’d appreciate it.

Thanks!


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

Thanks Walter. Strange thing happened though. I went to start setting up the form and kept coming up with just the error page, so I went back to another website that I had successfully used the PHPFF action to create a contact form and now I’m having the same issue there. I get my error page every time I try to submit the form, but that page used to work just fine. I had been using FWP 5.4.2 and just installed FWP 5.6.4. Is there something that may have caused a problem when I upgraded? Before the upgrade the old PHPFF worked fine. Here is a link to the old form that no longer works. http://www.bendproweb.com/ddc/contact.html

Thanks again

Brian


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

Owing to the way that PHPFF works, it’s not going to be possible to diagnose this without seeing the raw code in the your-form-name-go.php file that the Action generates and uploads. PHP files are stripped of all code before they are served by Apache, so just linking to it won’t help, either. You need to post it on Gist or Pastie and then post a link to that. But before you do that, did you update to the latest version of PHPFF when you upgraded Freeway?

Walter

On May 25, 2012, at 12:08 PM, Brian Yun wrote:

Thanks Walter. Strange thing happened though. I went to start setting up the form and kept coming up with just the error page, so I went back to another website that I had successfully used the PHPFF action to create a contact form and now I’m having the same issue there. I get my error page every time I try to submit the form, but that page used to work just fine. I had been using FWP 5.4.2 and just installed FWP 5.6.4. Is there something that may have caused a problem when I upgraded? Before the upgrade the old PHPFF worked fine. Here is a link to the old form that no longer works. http://www.bendproweb.com/ddc/contact.html

Thanks again

Brian


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

The first thing you should do is create different error pages depending on the fault.

In the action interface you can choose to select a Page for each error in the 1st dropdown.

Then create an error page for each. What I do is just create a page with the following text - nothing else

Not in Domain

Server Failure

Invalid Email

1 page for each and make sure that they are chosen in the appropriate selector.

Then go back to your form and correct the following

Name field under the 3rd Tab (Name) should say name - case sensitive

Email field 3rd Tab (Name) should say email - also case sensitive

Currently you have Name and Email in yours.

Once you have done that re-upload and test and see which error page you get.

David


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

And as a little aside.

Your background image http://www.bendproweb.com/ddc/Resources/ddcfullbackground.png is over 4.5Mb.

That is HUGE! And makes that page very slow to load.

It could easily be reduced to less than a couple of hundred K. First step would be to make it a jpeg and then reduce its quality.

Background images are for the background and dont need to be high quality.

D


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

Walter and DeltaDave - I tried a combination of your suggestions and have my form working again. I downloaded the PHPFF action again and reinstalled it. Then I renamed the name and email fields and made the separate error fields. Thanks!

DeltaDave - thanks for the heads up on the background. We had been playing around with different backgrounds and I completely spaced how huge the pic was.


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

So I setup a basic form that has some basic information I would need to collect. I’ve given each option in the menu/lists to have a value. When I submit the form I get an email that has each field and the value for the options selected. I’ve looked at the code and can see the values, but I can’t find a way to get those values to create a total. It is basic, but here is the form I made: http://www.bendproweb.com/ccc/estimator.html

Walter - any idea where I should go from here?


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

Glad you got the form working.

What Total is it you want to display - presumably a calculation of City x Stories x Sq Footage but what is the relationship between these?

Is there a specific charge for a City ie Bend is $50, Redmond $60 etc and does this just get added to the Stories x Area calculation - if so what is that ie

If I have one Storey and 0-1000 sq ft is my calculation 1 x $100, 2 Storeys x 1001-2000 = 2 x $150 etc.

David


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

David - Just as a way to understand how to code the form, I’ve assigned each answer on the form a value. ie Bend 10, Sisters 15, 1 story 0, 2 stories 15, etc. When the form is submitted, I get a list in an email that has each answer’s value. What I’d like to do somehow is when the form is submitted, it would redirect to page that totals each of those values into a number that would show up on the redirect page. Something like “Your project estimate is:” and then the total would automatically be filled in. At the same time, the information entered into the form would be emailed to the owner. Does that make sense?

Brian


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

I’ve used the PHP version of Forms To Go for years to make complicated
forms without overly taxing my tender, juicy, zombie-to-die-again-for
brain. You might check it out.
http://www.bebosoft.com/products/formstogo/overview


Ernie Simpson

On Sat, May 26, 2012 at 9:26 PM, Brian Yun email@hidden wrote:

David - Just as a way to understand how to code the form, I’ve assigned
each answer on the form a value. ie Bend 10, Sisters 15, 1 story 0, 2
stories 15, etc. When the form is submitted, I get a list in an email that
has each answer’s value. What I’d like to do somehow is when the form is
submitted, it would redirect to page that totals each of those values into
a number that would show up on the redirect page. Something like “Your
project estimate is:” and then the total would automatically be filled in.
At the same time, the information entered into the form would be emailed
to the owner. Does that make sense?


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

Thanks for the tip Ernie. I’ll check it out.

Brian


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

I’ve assigned each answer on the form a value. ie Bend 10, Sisters 15, 1 story 0, 2 stories 15, etc. When the form is submitted, I get a list in an email that has each answer’s value.

I understand that but what I need to know is how these numbers relate to each other. It cant be a simple addition - can it?

Have a look at http://www.deltadesign.co/fw_examples/select_adder.html

D


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

Actually it is kind of that simple. I know it is a total newbie thing, but I’ve never made a form that has needed to calculate anything before. So yeah, in the end it is simple addition. The values might be different, but I’ll understand how the code works. The twist to it is that the client doesn’t want the vistor to see the total until they have clicked submit so that he can gather information every time someone uses the estimate calculator. I looked at the source code for your page and see the part of the code that must do the calculating, is that code generated by FW or did you write that yourself? I’m sorry if this is an elementary question. I’m just starting to learn how HTML code works. Thanks for your patience.

Brian


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

the client doesn’t want the vistor to see the total until they have clicked submit

You can certainly hide the fields with the amounts in them from the visitor - the tricky part is getting that information displayed on the success page.

But in the real world your visitors will be disinclined to click the submit button unless they know what they are letting themselves in for. Personally I think that a feature like that will decrease your submit ratio dramatically. Better to not have the feature a all and let them wait for a response via phone or email. My 2c.

The code is added via the Protaculous Action interface in the Before and After Function Body sections and also relies on correct Naming and ID assignment to your various pickers and form fields.

If you revisit the example you will see the same form but with the fields hidden from the visitor.

D


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

Dave - Personally, I agree with your 2c, but it’s what he’s asking for. I revisited the link, and I think that he would be fine if the total showed up after they submitted, as long as the information was captured and sent to him. I’m still confused on how you get the form to do the calculations with FW. I’ve looked at every action I can and don’t see anything that would calculate any values. Did you write the function and used Protaculous to add the code to the page or is there something in FW that does calculations.

Brian


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

There is nothing native or Action-based that can do these calculations for you – and if you think about it, that’s as it should be, since there’s no way to tell what sort of calculations you might need.

If you want a live updating “estimate” form, (air-quotes because I want you to remember that anything that happens on the browser is inherently un-trustworthy) then you can do that with JavaScript, and Protaculous will give you easy hooks into the fields. Basic rules:

  1. Make sure that you give your form fields proper names. The content of the Title field in the left-most Inspector tab is meaningless, it’s just Freeway’s internal name for the field. The third tab from the left contains the Name field, which is where the actual name attribute for the form (which a form handler or script will need) is generated. A proper name is like an HTML ID: must begin with a letter or an underscore, should only contain letters, numbers, hyphens, or underscores. No spaces, no other punctuation of any kind. If you stick to a pattern of replacing spaces in the human-readable name with underscores, you can automatically replace them later: My Form Field becomes my_form_field, and then you can substitute an underscore followed by a letter with a space followed by a the capitalized form of that letter automagically.

  2. Make sure that you apply the FormFix Action to the page. This will clean up some foibles in Freeway’s form element code. It will apply IDs to each field, fix a nagging problem with select (picking list) fields, and I think it does some voodoo with radio buttons, although I can’t recall at the moment.

If you’ve done these things, then you can get a handle on the form element you want to add to another like this (in Protaculous):

$('calculate_button').observe('click', function(evt){
	var one = parseInt($F('item_one'), 10);
	var two = parseInt($F('item_two'), 10);
	//your math here
	var total = (one + two * 42) / 100;
	$('output_area').update(total);
});

That’s an extremely naive bit of code, doesn’t check anything for proper values or anything, but it shows off a few Prototype features. $F() is a shortcut for Element.getValue(), and it wants the ID of the field you are reading as its one argument. update() takes its input and inserts it into the item it’s chained from. It can take anything – plain text or HTML – as its input. If the latter, the actual DOM element will be created and inserted, not the text that describes that element.

Now you can do any of this on the server as well, and if you need to trust the input, you should do that. Many applications I have worked on use JavaScript on the client to provide a fast user response, but then duplicate the entire thing on the server where the variables can’t be fiddled with.

Walter

On Jun 9, 2012, at 1:45 AM, Brian Yun wrote:

Dave - Personally, I agree with your 2c, but it’s what he’s asking for. I revisited the link, and I think that he would be fine if the total showed up after they submitted, as long as the information was captured and sent to him. I’m still confused on how you get the form to do the calculations with FW. I’ve looked at every action I can and don’t see anything that would calculate any values. Did you write the function and used Protaculous to add the code to the page or is there something in FW that does calculations.

Brian


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

Brian

As Walter suggests there is no action in FW that will ‘do this’ for you.

You have to plug the javascript into the page to get the value out.

Working on the values you suggested for the Location, # of Stories and Area the example page linked to http://www.deltadesign.co/fw_examples/select_adder.html adds these together for you (Form value)

If you think this calculation is meaningful for you (and your client) we can get this to display on the ‘success’ page.

Personally I think that the relationship between these values is more than a simple addition!

My email address is available at my FWT ‘People’ page.

D


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

Just one more point – if you want the calculation to display on a different page, then that will need to be done on the server, most likely with PHP. If you want to show a preview of the calculation on the page – before they submit – then that will be done with JavaScript. There’s no law against doing both, it’s often a very nice touch.

If you’ve used the FreewayTalk Web interface, then you’ve seen this in action with an additional wrinkle: Ajax. On FreewayTalk, while you are typing your message in the form field, a copy is being updated in the live preview, so you can see how it will look before you submit your message. This lets you see the result of Markdown formatting in real time. The raw form data is sent by JavaScript to the server, where it runs through the formatter and is sent back as HTML. The preview pane is updated with the server-generated HTML. This means that the code to do the calculation (well, translation) only has to live in one place, rather than being duplicated in JavaScript and PHP. That might be an interesting way to structure your application if you decide to do a live preview as well as your traditional form submit.

Walter

On Jun 9, 2012, at 1:39 PM, DeltaDave wrote:

Brian

As Walter suggests there is no action in FW that will ‘do this’ for you.

You have to plug the javascript into the page to get the value out.

Working on the values you suggested for the Location, # of Stories and Area the example page linked to http://www.deltadesign.co/fw_examples/select_adder.html adds these together for you (Form value)

If you think this calculation is meaningful for you (and your client) we can get this to display on the ‘success’ page.

Personally I think that the relationship between these values is more than a simple addition!

My email address is available at my FWT ‘People’ page.

D


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