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
Address Label Changes
Started 15 years ago by webcommerce | 2 posts |
-
I want to make the following changes to the Address label on my form:
1. Remove address2 input line
2. Change Zip etc to PostCode
3. Change State etc to just State, with dropdown box choices (Australian)
4. Remove Country dropdown completelyIs it possible to do this?
Or do I need to set it up as separate labels for each input? If this is the only way to do it, is there any way I can put a box border around this group of labels?I have seen some discussion about the address label on the forum, but nothing that seems to be what I want to achieve. Hopefully, there is a solution??
Regards,
Ron SPosted 15 years ago # -
Hi Ron,
It will take a lot of code customization :), you should edit "view-function.php" to do this. Try go to around line 1401 ~ 1437, you will see this code :
$element_markup = <<<EOT <li id="li_{$element->id}" {$error_class}> <label class="description">{$element->title} {$span_required}</label> <div id="li_{$element->id}_div_1"> <input id="element_{$element->id}_1" name="element_{$element->id}_1" class="element text large" value="{$element->populated_value['element_'.$element->id.'_1']['default_value']}" type="text" /> <label for="element_{$element->id}_1">{$lang['address_street']}</label> </div> <div id="li_{$element->id}_div_2"> <input id="element_{$element->id}_2" name="element_{$element->id}_2" class="element text large" value="{$element->populated_value['element_'.$element->id.'_2']['default_value']}" type="text" /> <label for="element_{$element->id}_2">{$lang['address_street2']}</label> </div> <div id="li_{$element->id}_div_3" class="left"> <input id="element_{$element->id}_3" name="element_{$element->id}_3" class="element text medium" value="{$element->populated_value['element_'.$element->id.'_3']['default_value']}" type="text" /> <label for="element_{$element->id}_3">{$lang['address_city']}</label> </div> <div id="li_{$element->id}_div_4" class="right"> <input id="element_{$element->id}_4" name="element_{$element->id}_4" class="element text medium" value="{$element->populated_value['element_'.$element->id.'_4']['default_value']}" type="text" /> <label for="element_{$element->id}_4">{$lang['address_state']}</label> </div> <div id="li_{$element->id}_div_5" class="left"> <input id="element_{$element->id}_5" name="element_{$element->id}_5" class="element text medium" maxlength="15" value="{$element->populated_value['element_'.$element->id.'_5']['default_value']}" type="text" /> <label for="element_{$element->id}_5">{$lang['address_zip']}</label> </div> <div id="li_{$element->id}_div_6" class="right"> <select class="element select medium" id="element_{$element->id}_6" name="element_{$element->id}_6"> {$country_markup} </select> <label for="element_{$element->id}_6">{$lang['address_country']}</label> </div> {$guidelines} {$error_message} </li> EOT;
replace with this
$element_markup = <<<EOT <li id="li_{$element->id}" {$error_class}> <label class="description">{$element->title} {$span_required}</label> <div id="li_{$element->id}_div_1"> <input id="element_{$element->id}_1" name="element_{$element->id}_1" class="element text large" value="{$element->populated_value['element_'.$element->id.'_1']['default_value']}" type="text" /> <label for="element_{$element->id}_1">{$lang['address_street']}</label> </div> <div id="li_{$element->id}_div_2" style="display:none !important"> <input id="element_{$element->id}_2" name="element_{$element->id}_2" class="element text large" value="{$element->populated_value['element_'.$element->id.'_2']['default_value']}" type="text" /> <label for="element_{$element->id}_2">{$lang['address_street2']}</label> </div> <div id="li_{$element->id}_div_3" class="left"> <input id="element_{$element->id}_3" name="element_{$element->id}_3" class="element text medium" value="{$element->populated_value['element_'.$element->id.'_3']['default_value']}" type="text" /> <label for="element_{$element->id}_3">{$lang['address_city']}</label> </div> <div id="li_{$element->id}_div_4" class="right"> <select class="element select medium" id="element_{$element->id}_4" name="element_{$element->id}_4"> {$state_markup} </select> <label for="element_{$element->id}_4">{$lang['address_state']}</label> </div> <div id="li_{$element->id}_div_5" class="left"> <input id="element_{$element->id}_5" name="element_{$element->id}_5" class="element text medium" maxlength="15" value="{$element->populated_value['element_'.$element->id.'_5']['default_value']}" type="text" /> <label for="element_{$element->id}_5">{$lang['address_zip']}</label> </div> <div id="li_{$element->id}_div_6" class="right" style="display:none !important"> <select class="element select medium" id="element_{$element->id}_6" name="element_{$element->id}_6"> {$country_markup} </select> <label for="element_{$element->id}_6">{$lang['address_country']}</label> </div> {$guidelines} {$error_message} </li> EOT;
and to insert your state drop down value, go to around line 1351 and you'll find this :
$country[193]['value'] = "Zimbabwe";
add this code bellow that line
$state[0]['label'] = "australian"; $state[0]['value'] = "australian"; $state[1]['label'] = "australian1"; $state[1]['value'] = "australian1"; $state_markup = '' ; foreach ($state as $data_state){ $state_markup .= "<option value=\"{$data_state['value']}\" >{$data_state['label']}</option>\n"; }
To change your address field label, you should edit "includes/languages.php", try to search "address" section in there. You should find this :
//address $lang['address_street'] = 'Street Address'; $lang['address_street2'] = 'Address Line 2'; $lang['address_city'] = 'City'; $lang['address_state'] = 'State / Province / Region'; $lang['address_zip'] = 'Postal / Zip Code'; $lang['address_country'] = 'Country';
Change the value as your requirement
MachForm Support
Posted 15 years ago #
Reply
You must log in to post.