Appnitro Software Forums » MachForm

[closed] Price field - No decimals option.

(2 posts)
  • Started 1 year ago by adrianwilliams
  • Latest reply from yuniar

  1. Can the price field have an option for integer values only - For example Dollars without cents, Euros without cents etc. ?

    Posted 1 year ago #
  2. You could hide the cents by editing includes/view-functions.php file.

    Around line 756 (inside display_money() function) search for this code:

    $element_markup = <<<EOT
    		<li id="li_{$element->id}" {$error_class}>
    		<label class="description" for="element_{$element->id}">{$element->title} {$span_required}</label>
    		<span class="symbol">{$cur_symbol}</span>
    		<span>
    			<input id="element_{$element->id}_1" name="element_{$element->id}_1" class="element text currency" size="10" value="{$element->populated_value['element_'.$element->id.'_1']['default_value']}" type="text" /> .
    			<label for="element_{$element->id}_1">{$main_cur}</label>
    		</span>
    		<span>
    			<input id="element_{$element->id}_2" name="element_{$element->id}_2" class="element text" size="2" maxlength="2" value="{$element->populated_value['element_'.$element->id.'_2']['default_value']}" type="text" />
    			<label for="element_{$element->id}_2">{$child_cur}</label>
    		</span>
    		{$guidelines} {$error_message}
    		</li>
    EOT;

    replace that code with this one:

    $element_markup = <<<EOT
    		<li id="li_{$element->id}" {$error_class}>
    		<label class="description" for="element_{$element->id}">{$element->title} {$span_required}</label>
    		<span class="symbol">{$cur_symbol}</span>
    		<span>
    			<input id="element_{$element->id}_1" name="element_{$element->id}_1" class="element text currency" size="10" value="{$element->populated_value['element_'.$element->id.'_1']['default_value']}" type="text" />
    			<label for="element_{$element->id}_1">{$main_cur}</label>
    		</span>
    
    		{$guidelines} {$error_message}
    		</li>
    EOT;

    That should hide the cents on the resulting form.

    Posted 1 year ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.