<select name="sel" eform="::1">[!show_list!]</select>
eForm parses your form to create automatic validation rules for select boxes by reading all the options and adding them to a #LIST rule. However your [!show_list!] snippet isn’t executed until
after eForm has finished it’s work so all that’s in the #LIST rule is the actual "[!show_list!]" string.
There are 2 ways around this. The first is to add your own validation rule to the select field. For instance a #RANGE rule if the option values are all numeric, or any other rule that is appropriate for your form. See the eForm documentation in assets/snippets/eform/docs/.
The second is to use the eFormOnBeforeFormParse event and write yourself a function which inserts the options into the form template before it is parsed. As you already have the show_list snippet you can rewrite this or call it from an event function. Something like this in a new snippet should work:
<?php
if(!function_exists('formParseEvent'){
function formParseEvent( &$fields, &$templates){
global $modx;
$values = $modx->runSnippet('show_list');
$templates['tpl'] = str_replace['[+option_list+]',$values,$templates['tpl']);
return true;
}
}
return '';
?>
changing your select like this:
<select name="sel" eform="::1">[+option_list+]</select>
adding the new snippet before the eForm call and adding the event to the eForm call:
[[eventFunctionSnippet]]
[!eForm? eformOnBeforeFormParse=`formParseEvent` ....!]
This will let eForm do it’s own ’automatic’ validation with your options list