<?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: Turn a number post into range</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Turn a number post into range</description>
<language>en</language>
<pubDate>Thu, 18 Jun 2026 15:06:33 +0000</pubDate>

<item>
<title>offcourse on "Turn a number post into range"</title>
<link>https://www.machform.com/forums/topic/turn-a-number-post-into-range#post-23629</link>
<pubDate>Tue, 14 Jul 2015 22:38:02 +0000</pubDate>
<dc:creator>offcourse</dc:creator>
<guid isPermaLink="false">23629@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi&#60;/p&#62;
&#60;p&#62;Just wanted to share a little tweak I did to be able to turn a number field into a range field. I also turned the Number field into an  html5 &#34;number&#34; instead of &#34;text&#34;.&#60;/p&#62;
&#60;p&#62;I still have a couple doubts, because I am using the &#34;Custom CSS class&#34; field.&#60;/p&#62;
&#60;p&#62;Basically, I am using that field to tell Machform that it is a range field, rather than a regular number one. I am using the parameters min,max and default_value to prepare the slider and then I added a small section to show the currently selected value. Still needing to make the &#34;step&#34; value configurable, so ideas are welcome.&#60;/p&#62;
&#60;p&#62;The only thing I would like to try and understand was how to make use of the existing classes at the same time. For instance, by using column_2 and the new &#34;range&#34; value/class, how would I use them both.&#60;/p&#62;
&#60;p&#62;Suggestions are welcome, although for now this solves my problem.&#60;/p&#62;
&#60;p&#62;I edited the view-functions.php file and in line 2806 I added the following code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//build the tag for range is that is the class
		if($element-&#38;gt;css_class == &#38;#39;range&#38;#39;){
			$new_field_type = $element-&#38;gt;css_class;
			$rangeUpdater = &#38;#39;oninput=&#38;quot;outputUpdate(value)&#38;quot;&#38;#39;;
			$rangeValue = &#38;#39;&#38;lt;output for=fader id=range&#38;#39;.$element-&#38;gt;id.&#38;#39;&#38;gt;&#38;#39;.$element-&#38;gt;default_value.&#38;#39;&#38;lt;/output&#38;gt;&#38;#39;;
		}else{
			$new_field_type = &#38;#39;number&#38;#39;;
		}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Then change the code after that to accommodate these changes, so I replaced what was there by this:&#60;br /&#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; {$li_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}: {$rangeValue}&#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; min=&#38;quot;{$element-&#38;gt;range_min}&#38;quot; max=&#38;quot;{$element-&#38;gt;range_max}&#38;quot; step=&#38;quot;100&#38;quot; hint=&#38;quot;{$element-&#38;gt;css_class}&#38;quot; class=&#38;quot;element text {$element-&#38;gt;size}&#38;quot; type=$new_field_type {$maxlength} {$quantity_link_data_tag} value=&#38;quot;{$element-&#38;gt;default_value}&#38;quot; {$input_handler} {$rangeUpdater} /&#38;gt;
			{$range_limit_markup}

&#38;lt;script&#38;gt;
function outputUpdate(vol{$element-&#38;gt;id}) {
document.querySelector(&#38;#39;#range{$element-&#38;gt;id}&#38;#39;).value = vol{$element-&#38;gt;id};
}
&#38;lt;/script&#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;Any additions are very welcome.&#60;/p&#62;
&#60;p&#62;Also, adding all html5 field types to machforms, would be great. A switch/bollean field type would also work great.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
