Forums

Javascript Problem

ahwoogamac 18 Jul, 2008
While searching for a solution, I've found a few other people working on calculators on this forum. I created one myself by pulling from two scripts that I found. One script allows for the form to calculate the total cost by using field names and the onchange event. The other script adjusts the value of checkboxes (as well as calculating the total cost via the field names), using the onclick event, so that the total will reflect the click action.

If I leave the javascript in the fields, the calculation works, but the generated e-mail only shows the field titles - not the values. If I remove the script, the opposite happens.

I have attached a backup of the form. Also, a direct link to the form is at:

http://www.planetbobstudios.com/web-estimate-calculator.html

I'm not sure why the values of the fields aren't being included in the e-mail. [file name=web_price.cfbak size=24613]http://www.chronoengine.com/images/fbfiles/files/web_price.cfbak[/file]
ahwoogamac 18 Jul, 2008
Oh, I forgot to mention that I hid the "submit" button on my site. I did this so that people wouldn't try to send in the form, but they could still use the calculator.
GreyHead 19 Jul, 2008
Hi ahwoogamac,

I'm not completely sure what's happening but there seems to be a problem with the '.' in the field names. The field name 'PROD_Purchase_Secondary_10.00' shows up in the results array as 'PROD_Purchase_Secondary_10_00' - the '.' has switched to an '_'.

I don't know where or why this is happening but it would explain the problem I think.

Bob
ahwoogamac 19 Jul, 2008
I should have seen that staring at me right in the face! The demo of the script all used decimals, so I didn't think anything about using them. All my prices are whole number, so I just removed the "." and it worked fine. Thanks for helping me see the obvious.😉

A quick side question. As you can see, I'm using a php script that recognizes if a person is logged in. If their not, I'm inserting CB registration fields. Will there be a validation issue if I make those fields required? They won't be listed in the form when somebody is logged in. If so, is there way to work around that?
Max_admin 20 Jul, 2008
If I understand it correct then they will not be validated if they don't exist!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.