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

Add optgroup to countries dropdown


  1. philwareham
    Member

    Hi,
    Is it possible to manually edit the countries code within view-functions.php file so the countries can be within optgroup tags for the different continents. If so can you give me a couple of pointers on how to do it?
    Thanks,
    Phil

    Posted 14 years ago #
  2. yuniar

    The code for displaying the country dropdown is located around line 1430 - 1435 in your "includes/view-functions.php" file.

    You should find this code:

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

    You can replace "{$country_markup}" line with the HTML tag for the dropdown which includes the optgroup tag.


    MachForm Founder

    Posted 14 years ago #
  3. philwareham
    Member

    Thanks yuniar,
    The query I had really was if the id numbers in the country list are crucial to the working of machform and how it would affect (if at all) how you set a selected country when making up a form, for example...

    $country[11]['label'] = "Bahrain";
    $country[12]['label'] = "Bangladesh";
    $country[13]['label'] = "Barbados";

    and...

    $country[11]['value'] = "Bahrain";
    $country[12]['value'] = "Bangladesh";
    $country[13]['value'] = "Barbados";

    So I can replace all this with standard option tags where {$country_markup} was without breaking machform, yes?

    Posted 14 years ago #
  4. yuniar

    Yes, you can replace it with standard tags, replacing the {$country_markup}
    It won't break your machform.


    MachForm Founder

    Posted 14 years ago #

RSS feed for this topic

Reply