Forums

Database Record Save

adam.hughes 31 Mar, 2015
I have a simply form in chronoforms that just takes a name, email, date and details from a customer and sends an email. I also have the database save option on and set up, but it is not saving the records at all.

I have been though the article below which describes what to check for and everything looks okay (url below), but my form is not saving any data.

http://www.chronoengine.com/faqs/2619-my-form-data-isnt-saving-to-the-database-correctly

I created the table using the create table button in chronoforms and simply changed the ID to cf_id , uniq_id to cf_uiniq_id, user_id to cf_user_id and removed teh enable flag for the submit button.
My form has the following fields in :
1 : Text field called name
2 : Text field called email
4 : Text field called pdate (for purchase date)
5 : Text field called details
6: Submit button
7 : Recaptcha field

The HTML for the form is as follows :


<div class="form-group gcore-form-row" id="form-row-name"><label for="name" class="control-label gcore-label-left">Name</label>
<div class="gcore-input gcore-display-table" id="fin-name"><input name="name" id="name" value="" placeholder="" maxlength="100" size="50" class="input-lg validate['required','alphanum'] form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="Enter your name here" type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-email"><label for="email" class="control-label gcore-label-left">Email</label>
<div class="gcore-input gcore-display-table" id="fin-email"><input name="email" id="email" value="" placeholder="" maxlength="100" size="50" class="input-lg validate['required','email'] form-control A" title="" style="" data-inputmask="" data-load-state="" data-tooltip="Enter your email address here" type="text" /></div></div><div class="form-group gcore-form-row" id="form-row-pdate"><label for="pdate" class="control-label gcore-label-left">Purchase Date</label>
<div class="gcore-input gcore-display-table" id="fin-pdate"><input name="pdate" id="pdate" value="" data-gdatetimepicker-format="d-m-Y" placeholder="" size="50" class="input-lg validate['required'] form-control A" title="" style="" data-load-state="" data-tooltip="Select the date of purchase" type="text" data-fieldtype="gdatetimepicker" data-start_date="01-01-2015" data-start_view="d" /></div></div><div class="form-group gcore-form-row" id="form-row-details"><label for="details" class="control-label gcore-label-left">Details</label>
<div class="gcore-input gcore-display-table" id="fin-details"><textarea name="details" id="details" placeholder="" rows="3" cols="50" class="input-lg validate['required'] form-control A" title="" style="" data-wysiwyg="0" data-load-state="" data-tooltip="Enter the details of the issue here"></textarea></div></div><div class="form-group gcore-form-row" id="form-row-recaptcha"><label for="recaptcha" class="control-label gcore-label-left">Human Check</label>
<div class="gcore-input gcore-display-table" id="fin-recaptcha">{ReCaptcha}</div></div><div class="form-group gcore-form-row" id="form-row-submit"><div class="gcore-input gcore-display-table" id="fin-submit"><input name="submit" id="submit" type="submit" value="Submit Request" class="btn btn-primary form-control A" style="" data-load-state="" /></div></div>


Cheers
GreyHead 31 Mar, 2015
Hi adam.hughes,

Please first try clicking the Delete Cache icon in the Forms Manager toolbar. ChronoForms saves table info for 24 hours and this may be the problem.

If that doesn't work Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

Bob
adam.hughes 31 Mar, 2015
The clear cache did not help, but the debugger has given me the following info :


Array
(
    [12] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Error creating the model class, please try a different model id.
                )

        )

)
adam.hughes 31 Mar, 2015
The model ID was set to 5PCW so I have switched it to ALDI5PCW and tried again.
It then saved the record.

It looks like the issue was the use of the number at the start of the model id.

At the moment it looks like it is working fine.

Thank you for your help
GreyHead 31 Mar, 2015
Hi Adam,

Than makes sense, at some point that model name is used as a PHP variable name or a MySQL name and neither of those allow names that start with numbers. You should also avoid spaces and any characters other than [a-z][0-9] and underscore.

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

VPS & Email Hosting 20% discount
hostinger