<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Simple Calculation prior to sending form.</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Simple-Calculation-prior-to-sending-form_-78653</link>
        <description></description>
        <pubDate>Fri, 10 Apr 2026 10:02:26 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Simple-Calculation-prior-to-sending-form_-78653" rel="self" type="application/rss+xml" />

                <item>
          <title>Simple Calculation prior to sending form.</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230168#post2230168</link>
          <description><![CDATA[<p>Hey, that's pretty cool also!  Bookmarked!</p>]]></description>
          <pubDate>Thu, 11 Apr 2013 01:14:53 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230168#post2230168</guid>
        </item>
                <item>
          <title>Simple Calculation prior to sending form.</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230167#post2230167</link>
          <description><![CDATA[<p><em><strong>Funny... I was working with that just last night. Works well.</strong></em></p>
<p>Here's another neat block of code that you find interesting for calculating the form's progress to completion:</p>
<p><strong>A little CSS:</strong></p>
<p><code>&lt;style type="text/css"&gt;<br />#completion_meter {<br /> float:right;<br /> position:fixed;<br /> margin-top:20px;<br /> background-color:#FFF;<br />}<br />&lt;/style&gt;</code></p>
<p><strong>The Javascript:</strong></p>
<p><code>&lt;script type="text/javascript"&gt;<br />(function($){<br />    $.fn.percentComplete = function(selector, color, size){<br />        return this.each(function(){<br />            var fieldCount = $(selector).not(":radio").length;<br />            var names = [];<br />            $(selector+":radio").each(function(){<br /> var n = $(this).attr('name');<br />                if(names.indexOf(n) &lt; 0){<br />                    names.push(n);<br />                }<br />            });<br />            fieldCount = fieldCount + names.length;<br />            if(fieldCount){<br />                var completeCount = $(selector+"[value!='']").not(":checkbox").not(":radio").length + $(selector+":checked").length;<br />                var percentComplete = Math.round((completeCount / fieldCount) * 100);<br />                $(this).empty().append(percentComplete + "% Complete&lt;br&gt;&lt;div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;/div&gt;").children("div").css({"width": size, "border": "1px solid"+color}).children("div").css({"width": percentComplete+"%", "background-color":color});<br />            }<br />        });<br />    };<br />})(jQuery);<br /><br />$("document").ready(function(){<br />    $("#completion_meter").percentComplete(".percentage", "#006BAF", "306px");<br />    $(":input").blur(function(){<br />        $("#completion_meter").percentComplete(".percentage", "#006BAF", "306px");<br />    });<br />});<br />&lt;/script&gt;</code></p>
<p><strong>A litte bit of form code as a sample</strong>... see the word "percentage" placed inside the class="<span>text-field <strong>percentage</strong></span>"</p>
<p><code>&lt;div class="field-description"&gt;First Name:&lt;/div&gt;<br />    &lt;input type="text" name="first_name" class="text-field percentage" size="48" tabindex="1" value = "&lt;?php echo @$_REQUEST['first_name'];?&gt;" /&gt;<br />    <br />&lt;div class="field-description"&gt;Last Name:&lt;/div&gt;<br />    &lt;input type="text" name="last_name" class="text-field percentage" size="48" tabindex="2" value = "&lt;?php echo @$_REQUEST['last_name'];?&gt;" /&gt;<br /></code></p>
<p><strong>And the percentage meter:</strong></p>
<p><code>&lt;div id="completion_meter"&gt;&lt;/div&gt;<br /></code></p>
<p><strong>Sourced from: </strong><a href="http://forrst.com/posts/jQuery_Percent_Completed_Meter_a_jquery_plugin-Rv3" rel="nofollow">http://forrst.com/posts/jQuery_Percent_Completed_Meter_a_jquery_plugin-Rv3</a></p>]]></description>
          <pubDate>Thu, 11 Apr 2013 01:02:17 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230167#post2230167</guid>
        </item>
                <item>
          <title>Simple Calculation prior to sending form.</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230146#post2230146</link>
          <description><![CDATA[<p>Mate - it's brilliant!  Thanks.</p>
]]></description>
          <pubDate>Tue, 09 Apr 2013 00:13:11 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230146#post2230146</guid>
        </item>
                <item>
          <title>Simple Calculation prior to sending form.</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230145#post2230145</link>
          <description><![CDATA[<p>Hi</p>
<p>I think that you can use Javascript.<br /><br />An example here:</p>
<p><a href="http://stackoverflow.com/questions/7563879/how-to-calculate-active-total-using-javascript-for-html-form" rel="nofollow">http://stackoverflow.com/questions/7563879/how-to-calculate-active-total-using-javascript-for-html-form</a></p>
<p>Hope that helps!</p>
<p>Djulia</p>]]></description>
          <pubDate>Mon, 08 Apr 2013 23:39:48 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230145#post2230145</guid>
        </item>
                <item>
          <title>Simple Calculation prior to sending form.</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2230144#post2230144</link>
          <description><![CDATA[<p>Hi All.</p>
<p>I've got a simple emailForm.php that is acting as a booking form. ie.</p>
<p><code>        &lt;form method="POST" action=""&gt;<br />         &lt;input type="hidden" name="submitForm" value="1" /&gt;<br />         <br />         <br />         &lt;?php if (@$errorsAndAlerts): ?&gt;<br />           &lt;div style="color: red; font-weight: bold; font-size: 16px; font-family: arial;"&gt;&lt;br/&gt;<br />             &lt;?php echo $errorsAndAlerts; ?&gt;&lt;br/&gt;&lt;br/&gt;<br />           &lt;/div&gt;<br />         &lt;?php endif ?&gt;<br />         <br />         &lt;table border="0" cellspacing="0" cellpadding="2"&gt;<br />          &lt;tr&gt;<br />           &lt;td width="150"&gt;A&lt;/td&gt;<br />           &lt;td&gt;&lt;input type="text" name="a" value="&lt;?php echo htmlspecialchars(@$_REQUEST['a']); ?&gt;" size="50" /&gt;&lt;/td&gt;<br />          &lt;/tr&gt;<br />          &lt;tr&gt;<br />           &lt;td width="150"&gt;B&lt;/td&gt;<br />           &lt;td&gt;&lt;input type="text" name="b" value="&lt;?php echo htmlspecialchars(@$_REQUEST['b']); ?&gt;" size="50" /&gt;&lt;/td&gt;<br />          &lt;/tr&gt;<br />         &lt;tr&gt;<br />           &lt;td width="150"&gt;A + B&lt;/td&gt;<br />           &lt;td&gt;&lt;input type="text" name="c" value="&lt;?php echo htmlspecialchars(@$_REQUEST['c']); ?&gt;" size="50" /&gt;&lt;/td&gt;<br />          &lt;/tr&gt;<br />          &lt;tr&gt;<br />           &lt;td colspan="2" align="center"&gt;<br />             &lt;br/&gt;<br />             &lt;input type="submit" name="submit" value="Send Message &amp;gt;&amp;gt;"&gt;<br />           &lt;/td&gt;<br />          &lt;/tr&gt;<br />         &lt;/table&gt;<br />         <br />         &lt;/form&gt;</code></p>
<p>How can I get the total of A + B to display in C? Prior to submitting the form?</p>]]></description>
          <pubDate>Mon, 08 Apr 2013 22:57:39 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2230144#post2230144</guid>
        </item>
              </channel>
    </rss>
  