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


  1. shay
    Member

    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
    Shay

    Posted 16 years ago #
  2. yuniar

    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 #
  3. carterjd
    Member

    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 ?
    Thanks

    Posted 15 years ago #
  4. jflatham
    Member

    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 #
  5. Matt
    Member

    Is this still the same for the new version?

    Posted 14 years ago #
  6. redityo

    @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 14 years ago #
  7. mmr
    Member

    I can't seem to find where to change for version 2... Can someone point me in the right direction please?

    Posted 14 years ago #
  8. redityo

    My above code refer to machform 2.2, have you try the code ?


    MachForm Support

    Posted 14 years ago #

RSS feed for this topic

Reply