<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: How to populate some hidden fields via javascript then submit?</title>
		<link>https://legacy.forums.gravityhelp.com/topic/how-to-populate-some-hidden-fields-via-javascript-then-submit</link>
		<description>Gravity Support Forums Topic: How to populate some hidden fields via javascript then submit?</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 04:35:34 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/how-to-populate-some-hidden-fields-via-javascript-then-submit" rel="self" type="application/rss+xml" />

		<item>
			<title>Carl Hancock on "How to populate some hidden fields via javascript then submit?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-populate-some-hidden-fields-via-javascript-then-submit#post-13539</link>
			<pubDate>Mon, 29 Nov 2010 12:41:03 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">13539@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;If all you rare doing is pre-populating a hidden field and not doing anything overly complex you can use the gform_field_value hook to populate a hidden field.&#60;/p&#62;
&#60;p&#62;In your case it would look like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
add_filter(&#38;quot;gform_field_value_ordernumber&#38;quot;, &#38;quot;populate_ordernumber&#38;quot;);
function populate_ordernumber($value){
return &#38;quot;TRA3232&#38;quot;;
}
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>umarglobal on "How to populate some hidden fields via javascript then submit?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-populate-some-hidden-fields-via-javascript-then-submit#post-13516</link>
			<pubDate>Mon, 29 Nov 2010 07:08:44 +0000</pubDate>
			<dc:creator>umarglobal</dc:creator>
			<guid isPermaLink="false">13516@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Carl,&#60;/p&#62;
&#60;p&#62;How would you go about doing that?&#60;/p&#62;
&#60;p&#62;I have created a hidden field which i wish to populate via the pre_submission hook action.&#60;br /&#62;
I have enabled the option &#34; Allow field to be populated dynamically&#34; and have given the parameter name &#34;ordernumber&#34;.&#60;/p&#62;
&#60;p&#62;say if for arguments sake i wish to add &#34;TRA3232&#34; value into the hidden field via the hooks action, would it be applied something like this below?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_pre_submission&#38;quot;, &#38;quot;pre_submission_handler&#38;quot;);
function pre_submission_handler($form_meta){
   $value = $form_meta[&#38;#39;ordernumber&#38;#39;];
   $value = &#38;#39;TRA3232&#38;#39;;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Is this how it would be applied ? Thanks :) Help or hints will be appreciated
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "How to populate some hidden fields via javascript then submit?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-populate-some-hidden-fields-via-javascript-then-submit#post-11876</link>
			<pubDate>Mon, 01 Nov 2010 11:11:54 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">11876@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yes, you could use the pre submission hook and do your calculation then and then populate the value of the hidden field so that it is then stored.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gregdickson12 on "How to populate some hidden fields via javascript then submit?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-populate-some-hidden-fields-via-javascript-then-submit#post-11842</link>
			<pubDate>Sun, 31 Oct 2010 12:10:15 +0000</pubDate>
			<dc:creator>gregdickson12</dc:creator>
			<guid isPermaLink="false">11842@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thinking i should have read more about hooks and filters?&#60;/p&#62;
&#60;p&#62;The following hooks and filters allow developers to integrate Gravity Forms with other plugins.&#60;/p&#62;
&#60;p&#62;gform_pre_submission&#60;/p&#62;
&#60;p&#62;This action hook runs during form submission after validation has taken place and before entry data has been saved.&#60;/p&#62;
&#60;p&#62;Is this the way to go?&#60;/p&#62;
&#60;p&#62;I need to only run this hook for this one form and i need to set the hidden field values on the post vars. Will play but would appreciate wiser minds advice / guidance.&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gregdickson12 on "How to populate some hidden fields via javascript then submit?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/how-to-populate-some-hidden-fields-via-javascript-then-submit#post-11841</link>
			<pubDate>Sun, 31 Oct 2010 12:03:59 +0000</pubDate>
			<dc:creator>gregdickson12</dc:creator>
			<guid isPermaLink="false">11841@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This may not be the best way to go about things but I am trying to code up a simple tax calculator via gravity forms.&#60;/p&#62;
&#60;p&#62;I have a standard gravityform that records the input values, etc, records the entries and sends appropriate confirmation/thank you emails but then the actual calculation is done manually offline and the customer sent another email with the results.&#60;/p&#62;
&#60;p&#62;What i want to be able to do is add the simple calculation logic in some automatic way so that I can cut out the manual process completely.&#60;/p&#62;
&#60;p&#62;Rather than code all the form logic manually (i.e. drop gravity completely) and loose all the cool validation, processing, recording and auto emailing that gravity gives me I came upon the idea of adding some javascript that does the calculation on the client before the post is sent and adds the the result to a hidden gravity input field. &#60;/p&#62;
&#60;p&#62;Is this possible?&#60;/p&#62;
&#60;p&#62;I have copied the source produced by the normal gravityform page into a custom theme template and reproduced the original form page's behaviour (appreciate this is brittle and means the auto gen'd ids could get broken and have to be manually &#34;aligned&#34;) but when i try and intercept the submit action with my own javascript or indeed provide my own href based fake submit button and then later call document.forms[&#34;gform_6&#34;].submit(); the form doesnt seem to submit properly. &#60;/p&#62;
&#60;p&#62;Is this the correct/appropriate way to achieve my use case?&#60;/p&#62;
&#60;p&#62;I am presuming that a quick javascript form update would be best.&#60;/p&#62;
&#60;p&#62;Is there another way to add some custom logic to the processing flow such that the form gets the calculated value?&#60;/p&#62;
&#60;p&#62;I also want to display the form's submitted values back to the user on the confirmation page, I am presuming this is possible using some standard technique?&#60;/p&#62;
&#60;p&#62;Thanks for your patience with a java programmer using wordpress and php for the first time!&#60;/p&#62;
&#60;p&#62;Greg
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
