<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: Create a field that calculates off other fields input</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Create a field that calculates off other fields input</description>
<language>en</language>
<pubDate>Sun, 03 May 2026 23:09:04 +0000</pubDate>

<item>
<title>grayfletch on "Create a field that calculates off other fields input"</title>
<link>https://www.machform.com/forums/topic/create-a-field-that-calculates-off-other-fields-input#post-24157</link>
<pubDate>Sat, 03 Oct 2015 07:00:10 +0000</pubDate>
<dc:creator>grayfletch</dc:creator>
<guid isPermaLink="false">24157@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I dont know if you have the answer for this so ill show example i used&#60;br /&#62;
in the form properties - show more -load custom javascript file just put the url to your js file&#60;br /&#62;
IE: &#60;a href=&#34;http://localhost/machform/js/test.js&#34; rel=&#34;nofollow&#34;&#62;http://localhost/machform/js/test.js&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;as an example the test.js file saved in /machform/js/test.js&#60;/p&#62;
&#60;p&#62;$(document).ready(function () {&#60;/p&#62;
&#60;p&#62;    var one, two, total;&#60;br /&#62;
        if ($('#form_18163').length) {&#60;br /&#62;
            $(document).change(function () {&#60;br /&#62;
            one = $('#element_4').val();&#60;br /&#62;
            two = $('#element_5').val();&#60;br /&#62;
            total = parseFloat(one) + parseFloat(two);&#60;br /&#62;
            $('#element_10').val(parseFloat(total).toFixed(2));&#60;/p&#62;
&#60;p&#62;	});&#60;br /&#62;
    }&#60;br /&#62;
});&#60;/p&#62;
&#60;p&#62;obviously the #form id and #element fields will be specific to your installation&#60;br /&#62;
the #form id can be found when editing the form by the url in your browser&#60;br /&#62;
IE: &#60;a href=&#34;http://localhost/machform/edit_form.php?id=18163&#34; rel=&#34;nofollow&#34;&#62;http://localhost/machform/edit_form.php?id=18163&#60;/a&#62;&#60;br /&#62;
The #element fields can be found by going to&#60;br /&#62;
notifications-Send Notification Emails to My Inbox-more options -  press underlined template-variables&#60;br /&#62;
-pull down list for variable ie suma it will show the #element id for this variable&#60;/p&#62;
&#60;p&#62;A test form could include 3 fields&#60;br /&#62;
hide the total in this case element_10 with the logic setting until suma and sumb have some data
&#60;/p&#62;</description>
</item>
<item>
<title>web365 on "Create a field that calculates off other fields input"</title>
<link>https://www.machform.com/forums/topic/create-a-field-that-calculates-off-other-fields-input#post-24138</link>
<pubDate>Sun, 27 Sep 2015 23:17:15 +0000</pubDate>
<dc:creator>web365</dc:creator>
<guid isPermaLink="false">24138@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hello.&#60;/p&#62;
&#60;p&#62;May I know the detailed steps and the detailed javascript to include in the form properties to add the values of the 2 fields so that the third field will just show the sum of the 2 fields? &#60;/p&#62;
&#60;p&#62;Do I need to paste the actual javascript codes in the advanced option, or just the script URL?  If it is the script URL, should I paste the code in a notepad and save it with .js?  If I upload the .js file to /domain.com/machform/script/  should I enter in the URL /machform/script/xxx.js?&#60;/p&#62;
&#60;p&#62;Thank you.
&#60;/p&#62;</description>
</item>
<item>
<title>williamansley on "Create a field that calculates off other fields input"</title>
<link>https://www.machform.com/forums/topic/create-a-field-that-calculates-off-other-fields-input#post-22761</link>
<pubDate>Fri, 20 Feb 2015 04:31:23 +0000</pubDate>
<dc:creator>williamansley</dc:creator>
<guid isPermaLink="false">22761@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;@garrettruff: If you are running Machform 4.2, then you don't have to add the path to the script file to your code at all, you can use the new feature that lets you include the javascript file in your form properties. Edit the form, click on the &#34;Form Properties&#34; tab, click on the &#34;show more options&#34; link, scroll down to the bottom, and check the &#34;Load Custom Javascript File&#34; under &#34;Advanced Option&#34;.
&#60;/p&#62;</description>
</item>
<item>
<title>garrettruff on "Create a field that calculates off other fields input"</title>
<link>https://www.machform.com/forums/topic/create-a-field-that-calculates-off-other-fields-input#post-22758</link>
<pubDate>Fri, 20 Feb 2015 01:53:36 +0000</pubDate>
<dc:creator>garrettruff</dc:creator>
<guid isPermaLink="false">22758@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I have looked further add it seems it would need to be a java script that is inserted on the includes/ view-functions.php&#60;br /&#62;
I created a file with the script I think would work:&#60;/p&#62;
&#60;p&#62;$(document).ready(function () {&#60;/p&#62;
&#60;p&#62;    var one, two, total;&#60;br /&#62;
    // JavaScript for form_10859&#60;br /&#62;
    if ($('#form_10859').length) {&#60;/p&#62;
&#60;p&#62;        $('#element_28').prop('disabled', true);&#60;br /&#62;
        $(document).change(function () {&#60;br /&#62;
            one = $('#element_25').val();&#60;br /&#62;
            two = $('#element_27').val();&#60;br /&#62;
            total   = parseFloat(one) * parseFloat(two);&#60;br /&#62;
            $('#element_28').val(parseFloat(total).toFixed(2));&#60;br /&#62;
        });&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;I have tried adding the path the script file in multiple places under &#38;lt;head&#38;gt; but still dosn't work.  Anyone know if this is the right approach or what I may be missing?&#60;/p&#62;
&#60;p&#62;&#38;lt;head&#38;gt;;&#60;br /&#62;
{$custom_script_js}&#60;br /&#62;
&#38;lt;script type=&#34;text/javascript&#34; src=&#34;{$machform_path}includes/Custom.js&#34;&#38;gt;&#38;lt;/script&#38;gt;&#60;br /&#62;
&#38;lt;/head&#38;gt;
&#60;/p&#62;</description>
</item>
<item>
<title>garrettruff on "Create a field that calculates off other fields input"</title>
<link>https://www.machform.com/forums/topic/create-a-field-that-calculates-off-other-fields-input#post-22747</link>
<pubDate>Thu, 19 Feb 2015 06:57:38 +0000</pubDate>
<dc:creator>garrettruff</dc:creator>
<guid isPermaLink="false">22747@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I have tried searching the forums for a while but never found a solution.  I am looking for a way I can calculate square footage based on what my users insert in the length and width fields.  Searching through the files I noticed there is a CSS file specific to the form ID but cannot find one with the functionality.  I do want to get more complex later with summing the square footage totals then multiplying by a price per square foot field that will give me total cost but if someone can tell me how I can add the php code needed to make an element calculate and display the product I should be able to run with it.  Not sure if this is something I could set up in the database to calculate and have the field post what the database has for that field.  Or if anyone has done anything similar or knows where I could start or what files I would need to touch it would be greatly appreciated as I am a little lost on where to get started.&#60;/p&#62;
&#60;p&#62;(number field) Length = User enters data&#60;/p&#62;
&#60;p&#62;(number field) Width = User enters data&#60;/p&#62;
&#60;p&#62;(Calculate field or display) = The user data entered for length multiplied by the user entered data for width
&#60;/p&#62;</description>
</item>

</channel>
</rss>
