Records won't save to DB

mv 27 Jun, 2013
i have a form which works great (sends email and saves records to db) in a test preview
/index.php?option=com_chronoforms&tmpl=component&chronoform=sendemail

same form assigned to a module sends email but does not save records to db
/contact-us?chronoform=sendemail&event=submit

i have pasted debug code for both below as i believe it might be easy enough for someone to tell the reason why.

as i am running out of ideas any hint is much appreciated.

big thanks!

working form:
Array
(
    [option] => com_chronoforms
    [tmpl] => component
    [chronoform] => sendemail
    [event] => submit
    [Itemid] => 
    [question] => 01
    [input_submit_3] => Submit
    [recordtime] => 
    [integrated] => 
    [57914ff3742c659d83900066d3516165] => 1
    [chronoform_data] => Array
        (
            [cf_uid] => 71aec021fe442e8d1bebbef7dd2bbd77
            [cf_created] => 2013-06-27 16:47:34
            [cf_created_by] => 0
            [cf_ipaddress] => 94.112.192.186
            [cf_user_id] => 0
            [option] => com_chronoforms
            [tmpl] => component
            [chronoform] => sendemail
            [event] => submit
            [Itemid] => 

and this the one not working:
Array
(
    [chronoform] => sendemail
    [event] => submit
    [Itemid] => 43
    [option] => com_content
    [view] => article
    [id] => 44
    [question] => 02
    [recordtime] => 
    [integrated] => 
    [57914ff3742c659d83900066d3516165] => 1
    [chronoform_data] => Array
        (
            [cf_modified] => 2013-06-27 16:49:09
            [cf_modified_by] => 0
            [chronoform] => sendemail
            [event] => submit
            [Itemid] => 43
            [option] => com_content
            [view] => article
            [id] => 44
GreyHead 27 Jun, 2013
Hi mvd,

I think that you will find that the second one may have saved to the database but has done so by updating record 44 instead of creating a new record. This is because the article url includes &id=44 and you are also using (I guess) 'id' as the primary key for your table.

If this is correct then you can either rename the primary key, or add Custom Code to remove the id=44 value from the $form->data array before the DB Save.

Bob
mv 28 Jun, 2013
Hi Bob,

I much appreciate your time getting back to me.

You are spot on. The fix to the issue was to rename the primary ID key as indicated.

Big thanks!

Michal
This topic is locked and no more replies can be posted.