<?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: Define own Field Type</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Define own Field Type</description>
<language>en</language>
<pubDate>Wed, 06 May 2026 04:32:44 +0000</pubDate>

<item>
<title>yuniar on "Define own Field Type"</title>
<link>https://www.machform.com/forums/topic/define-own-field-type#post-486</link>
<pubDate>Mon, 31 Dec 2007 11:23:34 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">486@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi Hans,&#60;/p&#62;
&#60;p&#62;Try this, edit your &#60;strong&#62;includes/post-functions.php&#60;/strong&#62; file.&#60;br /&#62;
Around line 399 you will find this code:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;}elseif (&#38;#39;address&#38;#39; == $element_type){ //Address&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
Few lines below that code, on line 420, you will find this code:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$rules[$element_name_4][&#38;#39;required&#38;#39;] = true;&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
remove this line and the state checking would be removed.&#60;/p&#62;
&#60;p&#62;Let me know if you have trouble.
&#60;/p&#62;</description>
</item>
<item>
<title>villah on "Define own Field Type"</title>
<link>https://www.machform.com/forums/topic/define-own-field-type#post-481</link>
<pubDate>Sun, 30 Dec 2007 23:33:40 +0000</pubDate>
<dc:creator>villah</dc:creator>
<guid isPermaLink="false">481@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi Yuniar,&#60;br /&#62;
I've tried this and it works well... but... if the address block is required in the form and you have hidden the State field, for instance, you won't be able to submit the form since it will keep telling you that you need to fill out the required fields.. but since you can't see the state field.. &#60;/p&#62;
&#60;p&#62;Any ideas?&#60;/p&#62;
&#60;p&#62;Thanks!&#60;br /&#62;
Hans&#60;/p&#62;
&#60;p&#62;BTW: great piece of software!
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Define own Field Type"</title>
<link>https://www.machform.com/forums/topic/define-own-field-type#post-392</link>
<pubDate>Fri, 30 Nov 2007 16:45:14 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">392@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hmm.. you can always modify &#60;strong&#62;includes/view-functions.php&#60;/strong&#62; file for every display aspects.&#60;/p&#62;
&#60;p&#62;In your case, you will need to modify &#60;strong&#62;display_address()&#60;/strong&#62; function to dynamically show/hide the state based on the form id. &#60;/p&#62;
&#60;p&#62;Ok, around line 1302, search for this block:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;div class=&#38;quot;right&#38;quot;&#38;gt;
	&#38;lt;input id=&#38;quot;element_{$element-&#38;gt;id}_4&#38;quot; name=&#38;quot;element_{$element-&#38;gt;id}_4&#38;quot; class=&#38;quot;element text medium&#38;quot; value=&#38;quot;{$element-&#38;gt;populated_value[&#38;#39;element_&#38;#39;.$element-&#38;gt;id.&#38;#39;_4&#38;#39;][&#38;#39;default_value&#38;#39;]}&#38;quot; type=&#38;quot;text&#38;quot;&#38;gt;
	&#38;lt;label for=&#38;quot;element_{$element-&#38;gt;id}_4&#38;quot;&#38;gt;State / Province / Region&#38;lt;/label&#38;gt;
&#38;lt;/div&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
Remove that block, and replace it with:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;{$state_markup}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
Now.. few lines above, around line 1283, you will find this line:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$element_markup = &#38;lt;&#38;lt;&#38;lt;EOT&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
Above that line add this block:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$state_markup =&#38;lt;&#38;lt;&#38;lt;EOT
&#38;lt;div class=&#38;quot;right&#38;quot;&#38;gt;
	&#38;lt;input id=&#38;quot;element_{$element-&#38;gt;id}_4&#38;quot; name=&#38;quot;element_{$element-&#38;gt;id}_4&#38;quot; class=&#38;quot;element text medium&#38;quot; value=&#38;quot;{$element-&#38;gt;populated_value[&#38;#39;element_&#38;#39;.$element-&#38;gt;id.&#38;#39;_4&#38;#39;][&#38;#39;default_value&#38;#39;]}&#38;quot; type=&#38;quot;text&#38;quot;&#38;gt;
	&#38;lt;label for=&#38;quot;element_{$element-&#38;gt;id}_4&#38;quot;&#38;gt;State / Province / Region&#38;lt;/label&#38;gt;
&#38;lt;/div&#38;gt;
EOT;

$state_disabled = array(YOUR_FORM_ID);

if(in_array($_REQUEST[&#38;#39;id&#38;#39;],$state_disabled)){
	$state_markup = &#38;#39;&#38;#39;;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
And you are done. Don't forget the replace &#60;strong&#62;YOUR_FORM_ID&#60;/strong&#62; with your actual form id number. Like:&#60;br /&#62;
&#60;code&#62;$state_disabled = array(2);&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
Or if you want to disable the state for few forms, you can use a comma, like this:&#60;br /&#62;
&#60;code&#62;$state_disabled = array(2,3,4);&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
If those above sounds too difficult. Let me know.&#60;br /&#62;
I'll help you with the modification.
&#60;/p&#62;</description>
</item>
<item>
<title>juehec on "Define own Field Type"</title>
<link>https://www.machform.com/forums/topic/define-own-field-type#post-391</link>
<pubDate>Fri, 30 Nov 2007 04:56:50 +0000</pubDate>
<dc:creator>juehec</dc:creator>
<guid isPermaLink="false">391@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;i need no new field type, but i need for example a adress combo with the field&#60;br /&#62;
address, street, street2, zip, city, country, state and sometimes i need the same without state.&#60;/p&#62;
&#60;p&#62;Juergen
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Define own Field Type"</title>
<link>https://www.machform.com/forums/topic/define-own-field-type#post-380</link>
<pubDate>Thu, 29 Nov 2007 07:45:56 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">380@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I'm afraid there is no easy way to do this.&#60;br /&#62;
You will need to modify pretty much of the front end and backend code to do this.&#60;/p&#62;
&#60;p&#62;I'm just wondering, what field type do you want to add?
&#60;/p&#62;</description>
</item>
<item>
<title>juehec on "Define own Field Type"</title>
<link>https://www.machform.com/forums/topic/define-own-field-type#post-377</link>
<pubDate>Wed, 28 Nov 2007 21:20:59 +0000</pubDate>
<dc:creator>juehec</dc:creator>
<guid isPermaLink="false">377@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Is there a possibilty to define my own Field Type like the Address. If it is possible how can i do this.&#60;/p&#62;
&#60;p&#62;Thanks Juergen
&#60;/p&#62;</description>
</item>

</channel>
</rss>
