Hi,
I think I am having a similar problem.
I am trying to develop an application with modx that allows adding editing and removing data from a database table using eform.
I have added a dropdown select which gets its values from a table and i have got this to display but i can’t submit the form without the dropdown field reporting an error like
work provider » Incorrect value
i have the following in my form chunk
<select name="work_supplier" id="cFworkprovider" eform="A Color::1">
[[getworksuppliersdropdown]]
</select>
getworksuppliersdropdown is the following snippet
<?php
$output = '';//create variable for holding the output
$sql = $modx->db->query( 'SELECT * FROM `work_suppliers`');//define the DB query, in this case the table is named 'tblprojects', add WHERE AND etc. as needed
$resultArray = $modx->db->makeArray( $sql );//put it into an array
foreach($resultArray as $item)//go through each record in the array
{//start looping through the data array
$params['name']=$item['name'];//set the placeholders, the $params sets the name of the placeholder, the $item is the field name from the DB table
$params['ID']=$item['ID'];
$params['company']=$item['company'];
$output.=$modx->parseChunk('worksupplierdropTpl', $params, '[+', '+]');//define the chunk name and process the content, here it's ProjectTpl which has the placeholders for the data
}//finish looping through the data array
return $output;//now return the output from the processed chunk
?>
and
worksupplierdropTpl looks like
<OPTION VALUE="[+ID+]">[+name+] - [+company+]</OPTION>
but i am not sure how i should have it setup to make it work, I sort of understand that because the values of the dropdown are added after the form has been parsedeform cant see them to compare them and validate to the possible values but I am not sure how I should change my code to get it to work, especially when editing as i am trying to use the eFormOnBeforeFormParse to populate the data into the form.
I have searched around the forum and have found very little to do with adding editng and removing data from a database using modx, with or without eform, am i going around this the right way?
thanks
J