<?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: Limit number of chars per field</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Limit number of chars per field</description>
<language>en</language>
<pubDate>Wed, 06 May 2026 06:45:18 +0000</pubDate>

<item>
<title>yuniar on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-8712</link>
<pubDate>Wed, 17 Feb 2010 17:46:55 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">8712@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Are you sure you are using &#34;Single Line Text&#34; field already? Since the above code would work for that field type only. Using &#34;Number&#34; field won't work.&#60;/p&#62;
&#60;p&#62;The modification should affect all existing forms.
&#60;/p&#62;</description>
</item>
<item>
<title>Brainwrap on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-8697</link>
<pubDate>Tue, 16 Feb 2010 23:55:23 +0000</pubDate>
<dc:creator>Brainwrap</dc:creator>
<guid isPermaLink="false">8697@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi there; I'm attempting to limit the text boxes in my forms to 110 characters. I tried testing your method by swapping out the lines 40-47 with the exact code you suggested (I realize this would limit it to 10, not 110; this is just for testing purposes):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$set_max = &#38;#39;maxlength=&#38;quot;10&#38;quot;&#38;#39;;

$element_markup = &#38;lt;&#38;lt;&#38;lt;EOT
		&#38;lt;li id=&#38;quot;li_{$element-&#38;gt;id}&#38;quot; {$error_class}&#38;gt;
		&#38;lt;label class=&#38;quot;description&#38;quot;
for=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;&#38;gt;{$element-&#38;gt;title} {$span_required}&#38;lt;/label&#38;gt;
		&#38;lt;div&#38;gt;
			&#38;lt;input {$set_max}  id=&#38;quot;element_{$element-&#38;gt;id}&#38;quot; name=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;
class=&#38;quot;element text {$element-&#38;gt;size}&#38;quot; type=&#38;quot;text&#38;quot;
 value=&#38;quot;{$element-&#38;gt;default_value}&#38;quot; /&#38;gt;
		&#38;lt;/div&#38;gt;{$guidelines} {$error_message}
		&#38;lt;/li&#38;gt;
EOT;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;...with absolutely no effect whatsoever.&#60;/p&#62;
&#60;p&#62;Does this only impact forms or fields created *after* the code change, or should it impact existing forms/text boxes as well?
&#60;/p&#62;</description>
</item>
<item>
<title>microvb on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-4001</link>
<pubDate>Sat, 13 Dec 2008 07:13:02 +0000</pubDate>
<dc:creator>microvb</dc:creator>
<guid isPermaLink="false">4001@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Can you not just add something to the $element function.&#60;/p&#62;
&#60;p&#62;Aka:  &#60;/p&#62;
&#60;p&#62;$element-&#38;gt;max_size; ' Define the maximum amount of characters allowed for input&#60;br /&#62;
$element-&#38;gt;min_size; ' Used in validation to ensure the amount of characters is of the min size or greater&#60;/p&#62;
&#60;p&#62;This would be a simple method for accepting variable size input fields with certain size requirements. If the developers of MachForm added this functionality to their &#34;TextField&#34; and &#34;NumberField&#34; data types, this should resolve this problem nicely, also providing a way for people to easily modify the character restrictions.&#60;/p&#62;
&#60;p&#62;Speaking of that, if the developers of MachForm could also add a &#34;Store as String&#34; option to the &#34;NumberField&#34; data type, this would eliminate the problems in receiving values such as 1.26473828998432874+E15 when in fact it was supposed to be a really long number.&#60;/p&#62;
&#60;p&#62;Problem with using the &#34;TextField&#34; data type for input of long numbers is that it does not allow for restricting that field to ONLY accept numbers.
&#60;/p&#62;</description>
</item>
<item>
<title>redityo on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3894</link>
<pubDate>Wed, 03 Dec 2008 17:40:50 +0000</pubDate>
<dc:creator>redityo</dc:creator>
<guid isPermaLink="false">3894@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi Kmnet,&#60;/p&#62;
&#60;p&#62;I've got your mail, let's continue there
&#60;/p&#62;</description>
</item>
<item>
<title>kmnet on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3888</link>
<pubDate>Wed, 03 Dec 2008 14:39:17 +0000</pubDate>
<dc:creator>kmnet</dc:creator>
<guid isPermaLink="false">3888@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi. I just bought this software. I have a problem getting the text limit based on the above instructions to work. Can you further elaborate the steps?&#60;/p&#62;
&#60;p&#62;I need single line text field to have a maximum characters of only 30. Extremely crucial to my business.&#60;/p&#62;
&#60;p&#62;Thank you.
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3570</link>
<pubDate>Thu, 06 Nov 2008 20:37:16 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">3570@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Sorry wftsl, I'm afraid that won't be possible.&#60;br /&#62;
Thank you for your suggestion though.
&#60;/p&#62;</description>
</item>
<item>
<title>wftsl on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3568</link>
<pubDate>Thu, 06 Nov 2008 18:52:31 +0000</pubDate>
<dc:creator>wftsl</dc:creator>
<guid isPermaLink="false">3568@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi and thanks for your reply.&#60;/p&#62;
&#60;p&#62;Can't this be done directly from the form properties with a hack or update of the software?&#60;/p&#62;
&#60;p&#62;There are some forms I need to limit addresses, others I need to limit names, or text boxes, and this seems to be more complicated that what I expected.
&#60;/p&#62;</description>
</item>
<item>
<title>redityo on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3567</link>
<pubDate>Thu, 06 Nov 2008 18:42:47 +0000</pubDate>
<dc:creator>redityo</dc:creator>
<guid isPermaLink="false">3567@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;May I know, what element do you want to limit ? if it's all of element, I'm afraid you should do a lot of modification.&#60;br /&#62;
I have an example, in here you want to limit a &#34;text element&#34; in form 1 on element_1. To do that, you have to edit &#34;includes/view-functions.php&#34;, try to search between line 40 ~ 47 you will find this code :&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$element_markup = &#38;lt;&#38;lt;&#38;lt;EOT
		&#38;lt;li id=&#38;quot;li_{$element-&#38;gt;id}&#38;quot; {$error_class}&#38;gt;
		&#38;lt;label class=&#38;quot;description&#38;quot; for=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;&#38;gt;{$element-&#38;gt;title} {$span_required}&#38;lt;/label&#38;gt;
		&#38;lt;div&#38;gt;
			&#38;lt;input id=&#38;quot;element_{$element-&#38;gt;id}&#38;quot; name=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;
class=&#38;quot;element text {$element-&#38;gt;size}&#38;quot; type=&#38;quot;text&#38;quot;
 value=&#38;quot;{$element-&#38;gt;default_value}&#38;quot; /&#38;gt;
		&#38;lt;/div&#38;gt;{$guidelines} {$error_message}
		&#38;lt;/li&#38;gt;
EOT;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;after that replace with this one&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if ($_GET[&#38;#39;id&#38;#39;] == 1 &#38;#38;&#38;#38; $element-&#38;gt;id == 1)
			$set_max = &#38;#39;maxlength=&#38;quot;10&#38;quot;&#38;#39;;
		else
			$set_max = &#38;#39;&#38;#39;;

$element_markup = &#38;lt;&#38;lt;&#38;lt;EOT
		&#38;lt;li id=&#38;quot;li_{$element-&#38;gt;id}&#38;quot; {$error_class}&#38;gt;
		&#38;lt;label class=&#38;quot;description&#38;quot;
for=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;&#38;gt;{$element-&#38;gt;title} {$span_required}&#38;lt;/label&#38;gt;
		&#38;lt;div&#38;gt;
			&#38;lt;input {$set_max}  id=&#38;quot;element_{$element-&#38;gt;id}&#38;quot; name=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;
class=&#38;quot;element text {$element-&#38;gt;size}&#38;quot; type=&#38;quot;text&#38;quot;
 value=&#38;quot;{$element-&#38;gt;default_value}&#38;quot; /&#38;gt;
		&#38;lt;/div&#38;gt;{$guidelines} {$error_message}
		&#38;lt;/li&#38;gt;
EOT;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;if you want to have all &#34;text element&#34; limited, so you can ignore the &#34;if&#34; condition. It will be like this &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$set_max = &#38;#39;maxlength=&#38;quot;10&#38;quot;&#38;#39;;

$element_markup = &#38;lt;&#38;lt;&#38;lt;EOT
		&#38;lt;li id=&#38;quot;li_{$element-&#38;gt;id}&#38;quot; {$error_class}&#38;gt;
		&#38;lt;label class=&#38;quot;description&#38;quot;
for=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;&#38;gt;{$element-&#38;gt;title} {$span_required}&#38;lt;/label&#38;gt;
		&#38;lt;div&#38;gt;
			&#38;lt;input {$set_max}  id=&#38;quot;element_{$element-&#38;gt;id}&#38;quot; name=&#38;quot;element_{$element-&#38;gt;id}&#38;quot;
class=&#38;quot;element text {$element-&#38;gt;size}&#38;quot; type=&#38;quot;text&#38;quot;
 value=&#38;quot;{$element-&#38;gt;default_value}&#38;quot; /&#38;gt;
		&#38;lt;/div&#38;gt;{$guidelines} {$error_message}
		&#38;lt;/li&#38;gt;
EOT;&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>wftsl on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3566</link>
<pubDate>Thu, 06 Nov 2008 17:18:55 +0000</pubDate>
<dc:creator>wftsl</dc:creator>
<guid isPermaLink="false">3566@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Thanks webcommerce,&#60;/p&#62;
&#60;p&#62;I'd like to know if there is any &#34;out of the box&#34; solution for this problem, as I guess speaking of forms, this is very mandatory.&#60;/p&#62;
&#60;p&#62;Regards,&#60;br /&#62;
wftsl
&#60;/p&#62;</description>
</item>
<item>
<title>webcommerce on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3564</link>
<pubDate>Thu, 06 Nov 2008 16:33:52 +0000</pubDate>
<dc:creator>webcommerce</dc:creator>
<guid isPermaLink="false">3564@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;wftsl Hi,&#60;/p&#62;
&#60;p&#62;I too would like to know if there is a 'quick' way to do this, so hoping support has a solution. It would be useful for zip/postcode fields etc.&#60;/p&#62;
&#60;p&#62;You might also check out &#60;a href=&#34;http://www.dynamicdrive.com/dynamicindex16/&#34; rel=&#34;nofollow&#34;&#62;http://www.dynamicdrive.com/dynamicindex16/&#60;/a&#62; (Form Effects) which has some field limiting scripts. I haven't used any of these but I can say most of their scripts are pretty good (reliable).&#60;/p&#62;
&#60;p&#62;Regards,&#60;br /&#62;
Ron S
&#60;/p&#62;</description>
</item>
<item>
<title>wftsl on "Limit number of chars per field"</title>
<link>https://www.machform.com/forums/topic/limit-number-of-chars-per-field#post-3553</link>
<pubDate>Wed, 05 Nov 2008 22:00:11 +0000</pubDate>
<dc:creator>wftsl</dc:creator>
<guid isPermaLink="false">3553@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hello,&#60;/p&#62;
&#60;p&#62;How can I limit the number of characters per field?&#60;/p&#62;
&#60;p&#62;Best regards
&#60;/p&#62;</description>
</item>

</channel>
</rss>
