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

Adding an asterisk * to individual Address fields


  1. neilo
    Member

    Hello all,

    I have a current form which uses the address block, which contains six fields. The block - as a whole - is marked as requiring input, - the label 'Address' is marked with an asterisk (*) to indicate that an address is required.

    There is some confusion on the part of some users as to which of these fields is a required value. To make this clear to the users, I would like to add an asterisk to the labels of the individual required fields (Street, City, State/Province/Region, Zip/Postal Code, Country).

    Please could you advise me where any edits need to be made?

    Thanks.

    Posted 14 years ago #
  2. redityo

    Hi,

    You need to edit "includes/view-functions.php" for this, go to around line 1401 ~ 1437 for 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>&nbsp;{$guidelines} {$error_message}
    		</li>
    EOT;

    then change it to be like 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']} {$span_required}</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']} {$span_required}</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']} {$span_required}</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']} {$span_required}</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']} {$span_required}</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']} {$span_required}</label>
    	</div>&nbsp;{$guidelines} {$error_message}
    		</li>
    EOT;

    MachForm Support

    Posted 14 years ago #
  3. neilo
    Member

    Many thanks. Perfect.

    Posted 14 years ago #

RSS feed for this topic

Reply