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
Remove fields from address
Started 16 years ago by shay | 8 posts |
-
Hi, I'd like to know if its possible to remove the country and zip/code fields from the address entry in a form.
All of the form's users will be in the same country so it's not necessary to track that information.
Thanks
ShayPosted 16 years ago # -
Edit your includes/view-functions.php file, search around line 1307 - 1317 and you'll find this code:
<div 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">Postal / Zip Code</label> </div> <div 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">Country</label> </div>
Simply remove those code.MachForm Founder
Posted 16 years ago # -
Is it possible to do as the above, but make it apply to only some of the forms we have set up and not all of them ?
ThanksPosted 15 years ago # -
Yuniar, you may want to update the instructions above for removal of the zip code, country, or other address sub-fields, as the script and location are quite different in Machform 2.0.
This product is really sweet!
Posted 15 years ago # -
Is this still the same for the new version?
Posted 15 years ago # -
@carterjd
To apply those modification in some form, you can try these steps :
1. Go around line 1401, you will see this code :
$element_markup = <<<EOT
put these code above that line
if ($_GET['id'] != 53) { $add_address = <<<EOT <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> EOT; }
2. Then go to around line 1440 ~ 1441, you will see this :
<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>
change to this
{$add_address}
Those code will only change address element for form id = 53
@jflatham
Try to search around line 1425 ~ 1435
@Matt
My Above code works in version 2.x
MachForm Support
Posted 15 years ago # -
I can't seem to find where to change for version 2... Can someone point me in the right direction please?
Posted 15 years ago # -
My above code refer to machform 2.2, have you try the code ?
MachForm Support
Posted 15 years ago #
Reply
You must log in to post.