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
Lock in default field
Started 14 years ago by jlking98 | 2 posts |
-
I added a price field to my form. Is there a way to lock in a default price without allowing it to be changed?
Also, upon adding a default price with zero cents it only shows one zero (i.e. $1.0 instead of $1.00). Is there a way to make it show both digits?
Posted 14 years ago # -
yes, try to follow these steps :
1. Edit "includes/view-functions.php" file and go to around line 864 for this code
$element_markup = <<<EOT
then add these code above that line
if ($_GET['id'] == 1 && $element->id == 2) { $element->populated_value['element_'.$element->id.'_1']['default_value'] = '1'; $element->populated_value['element_'.$element->id.'_2']['default_value'] = '0'; $locked = ' readonly ' ; }
2. Go to around line 872~879 for these code
<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>
then change it to
<span> <input {$locked} 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 {$locked} 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>
in there I assume your form id is 1 and the currency field id is 2. Don't forget to change those id's with yours
MachForm Support
Posted 14 years ago #
Reply
You must log in to post.