Simply put, I need to automatically "create" a code that includes a field's value as part of a string.
This is what I currently have;
public function addsite()
{
$crud = $this->_getGroceryCrudEnterprise();
$crud->setTable('Companies');
$crud->setSubject('Sites', 'Site');
$crud->columns(array('Name','ContactName','ContactLastName','ContactNumber','ContactEmail','DateAdded'));
$crud->displayas('ContactName','Contact Name')
->displayas('ContactLastName','Contact Last Name')
->displayas('ContactNumber','Contact Number')
->displayas('ContactEmail','Contact Email')
->displayas('DateAdded','Date Added');
$crud->callbackaddfield('ConnectionString',array($this,'ConString_callback'));
$crud->readOnlyFields(array('ConnectionString'));
$output = $crud->render();
$this->_report_output($output, 'Add a Site');
}
function ConString_callback()
{
return 'Data Source=myserver;Initial Catalog=foodb;MultipleActiveResultSets=True;User Id=foobar;Password=123;';
}
What this does is automatically changes the ConnectionString field to the value generated in the ConString_callback function. Now my problem is; I need the "foodb" replaced with whatever the Name field's value is without any spaces and such. This can happen on keyup or on change, or whatever works best.
How do I proceed here?
