Hello all,
I have a form with some select options (dynamically generated, using a ditto call). Each item in this list has an id, which corresponds to a document. I would like the user to be able to select an item from the drop-down and then when he sends the form, he recieves an email with the corresponding [*price*] tv for the document he selected.
Have read through the material in the forum, but this one has got me stumped for the moment.
the snippet call is
[!getInfo!]
[!eForm? &formid=`getquote` &tpl=`quoteform` &to=`[email protected]` &subject=`Quote from Anglia Tours` &report=`quotereport` &eformOnBeforeFormParse=`getInfo`!]
This is the bit that generates the select options:
<?php
function getInfo( &$fields, &$templates ){
//do all your other stuff
$tourlist = tourList(); //Get value for $options from function, will be use for the dropdown options list
$templates['tpl'] = str_replace('[+optionsline+]', $tourlist, $templates['tpl'] ); //Set the [+optionsline+] placeholder with the options value from the ditto
return '';
}
// This function will use ditto to create a list of option for the dropdown option
function tourList(){
global $modx; // Call $modx
//these line below creates an array call $params with the ditto parameters;
$params['parents'] = '20';
$params['display'] = 'all';
$params['filter'] = '';
$params['tpl'] = 'optionsline';
$params['sortBy'] = 'longtitle';
$params['sortDir'] = 'ASC';
//once the $params array is set, modx run snippet api is called for Ditto, with the above $params.
$output = $modx->runSnippet('Ditto', $params);
return $output ;
}
?>
Any help would be mightily apprecited.