<option value="Afghanistan" [[!+fi.countries:FormItIsSelected=`Afghanistan`]]>Afghanistan</option>

<?php
$clRowTpl = isset( $clRowTpl ) ? $clRowTpl : 'clRowTpl';
$clOuterTpl = isset( $clOuterTpl ) ? $clOuterTpl : 'clOuterTpl';
$_country_lang = array();
include $modx->getOption('core_path').'lexicon/country/en.inc.php';
if ($modx->getOption('manager_language') != 'en' && file_exists($modx->getOption('core_path').'lexicon/country/'.$modx->getOption('manager_language').'.inc.php')) {
include_once $modx->getOption('core_path').'lexicon/country/'.$modx->getOption('manager_language').'.inc.php';
}
asort($_country_lang);
$countries = array();
$wrapper = "";
foreach ($_country_lang as $country) {
$modx->setPlaceholder('cl.country', $country);
$wrapper .= $modx->getChunk($clRowTpl);
}
$modx->setPlaceholder('cl.wrapper', $wrapper);
$output = $modx->getChunk($clOuterTpl);
return $output;<select name="country"[[!+fi.country:FormItIsSelected=`none`:is=`selected="selected"`:then=` class="invalid"`]]> <option value="none">Please select</option> [[+cl.wrapper]] </select>
<option value="[[+cl.country]]" [[!+fi.country:FormItIsSelected=`[[+cl.country]]`]]>[[+cl.country]]</option>
<?php
$clRowTpl = isset( $clRowTpl ) ? $clRowTpl : 'clRowTpl';
$clOuterTpl = isset( $clOuterTpl ) ? $clOuterTpl : 'clOuterTpl';
// added this option
$clSelected = isset( $clSelected ) ? $clSelected : '';
$_country_lang = array();
include $modx->getOption('core_path').'lexicon/country/en.inc.php';
if ($modx->getOption('manager_language') != 'en' && file_exists($modx->getOption('core_path').'lexicon/country/'.$modx->getOption('manager_language').'.inc.php')) {
include_once $modx->getOption('core_path').'lexicon/country/'.$modx->getOption('manager_language').'.inc.php';
}
asort($_country_lang);
$wrapper = "";
foreach ($_country_lang as $country) {
// added this if statement
if ($clSelected === $country) {
$modx->setPlaceholder('cl.selected', 'selected');
} else {
$modx->setPlaceholder('cl.selected', '');
}
$modx->setPlaceholder('cl.country', $country);
$wrapper .= $modx->getChunk($clRowTpl);
}
$modx->setPlaceholder('cl.wrapper', $wrapper);
$output = $modx->getChunk($clOuterTpl);
return $output;<option [[+cl.selected]]>[[+cl.country]]</option>
[[CountryList? &clRowTpl=`row` &clOuterTpl=`outer` &clSelected=`Australia`]]
hi all,
i keep trying everything above but all it does is break my page.
what am i doing wrong?
FYI 1:
in an effort to provide all the relevant info, here's what i'm using & doing...
- i have a registration form which can be viewed @ http://sanctuaryinternational.com/dev/register.html
note: this is a development directory - not "live" to the users yet. so feel free to give it a try if you want.
also note: you will know if it submits correctly when the submission takes you to a confirmation page.- i'm using the Materialize framework @ http://materializecss.com
i had thought it would be faster to setup this site with it than starting from scratch, is why.- am using ModX Revolution 2.4.2-pl (tho i'm not sure what the "pl" stands for)
- i've installed & using the Login 1.9.2-pl Extra @ https://rtfm.modx.com/extras/revo/login
- am using the Personalize 3.7.0-pl Extra @ http://bobsguides.com/personalize-tutorial.html
- am using the ReCaptchaV2 2.0.1-rc1 Extra @ https://github.com/sepiariver/recaptchav2
- & am using JQuery Validate 1.14.0 Plugin @ http://jqueryvalidation.org