FormitSaveForm and Success Message

I’ve got a working form that delivers fine and displays a success message. As soon as I add FormItSaveForm, it still sends but doesn’t save the form - any ideas?..

[[!FormIt?
    &hooks=`spam,email`
    &emailTpl=`flex_email_chunk`
    &emailFrom=`[[$mainemail]]`
    &emailTo=`[[$mainemail]]`
    &successMessage=`<p style="color:green; padding-top: 36px;">Thank you. Your message has been  submitted successfully, you will normally receive a reply within 24 hours.</p>`
    &emailUseFieldForSubject=`0`
    &emailSubject=`Website Contact Form`
    &validate=`nospam:blank,name:required,
    email:email:required,telephone:required,consent:required,
    text:required:stripTags`]]

Does it save the form successfully?
If FormItSaveForm is the last hook in the list and fails, then the email will still be sent (as the email hook runs before the saving) but the overall processing of the form will be incomplete and therefore there is no success message.

I think this is related to a database issue with strict MySQL (had a problem with manager logs not writing to database) as I’ve just go this error…

INSERT INTO `modx_formit_forms` (`form`, `context_key`, `values`, `ip`, `date`, `encrypted`, `encryption_type`, `hash`) VALUES ('form-1', 'web', '{\"nospam\":\"\",\"name\":\"Chris\",\"email\":\"xxx\",\"telephone\":\"xxx\",\"consent\":[\"Yes\"],\"coms\":\"Any\",\"text\":\"xxx\"}', 'xxx', 1740571753, 0, 1, 'xxx')
Array
(
    [0] => 23000
    [1] => 1062
    [2] => Duplicate entry '0' for key 'PRIMARY'

It looks like the auto-increment for the primary key of this table is not working. Check the database table and try adding it manually.

Thank you - that’s exactly what I’ve just done and it works. Not sure why auto-increment seems to have disappeared when moving from my server to the client’s server.

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.