I got by my delete issue by pulling it out of OnSubmit and moving things to the form HTML as below...
So only one problem left...
created the form tried to use the CF admin to create the table while setting the 'EmployeeName' field to a PK... failed db creation with an "auto_increment" error (odd as I know there was no check mark there) use the CF admin to create the table without a 'manual' PK verified the form could save to the db (insert 'my record') used MySQL Browser to edit the table and set the 'EmployeeName' field to a PK detached/reattached the table to the form in the CF Admin (to sense the db change) verified the form could update 'my record' in the db deleted the sole record using MySQL Browser so I could test my form switching between loading defaults (no record to load) and loading the users record to 'edit' submitted new form and found that my record was not added opened MySQL Browser to remove PK, detached/reattached db in CF Admin, and retest saved the record [/list:o]
Inserts and Updates should both work at the same time with the PK set on one of my fields right? What might I have done incorrectly?
<?php
global $user;
$user = &JFactory::getUser();
$database = &JFactory::getDBO();
if ($_REQUEST["delete"]){
$database->setQuery( "DELETE From #__chronoforms_carpooldrivers WHERE EmployeeName='$user->name'" );
if (!$result = $database->loadObject()) {
header( 'Location: http://intranet/index.php?option=com_chronocontact&chronoformname=CarPoolDrivers' ) ;
}
}
$database->setQuery( "SELECT
...
...
<input type="submit" value="Submit Form">
<input type="reset" value="Reset Form">
<input type=button value="Delete My Record" onClick="if (confirm('Delete <?php echo $user->name?>?')) window.location='index.php?option=com_chronocontact&chronoformname=CarPoolDrivers&delete=1';">
So only one problem left...
Problem 2
I also seem to have a problem using the "PRIMARY KEY" trick to have the form update the database; problem being that it kills the inserts of new records. Here is how I implemented it...
[list=1]
Inserts and Updates should both work at the same time with the PK set on one of my fields right? What might I have done incorrectly?