This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

[closed] Price field - No decimals option.


  1. adrianwilliams
    Member

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

    Posted 17 years ago #
  2. yuniar

    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.


    MachForm Founder

    Posted 17 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.