Skip Navigation

[Closed] Why generic field select isn't saved to DB

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#490130
date select not working.png

I am trying to figure out why a generic field isn't saved to the database.
I have 2 generic fields, type select in the same CRED, new post form.
One is saved - the other is not.
No errors in console or form.

This is not saved:

[cred_generic_field field='_wpcf_belongs_date_id' type='select' class='' urlparam='']
{
"required":1,
"validate_format":0,
"persist":1,
"default":[],
"options":[[wpv-view name="select-bookings-datum-raw"]]
}
[/cred_generic_field]

This is saved:

[cred_generic_field field='_wpcf_belongs_exhibitor_id' type='select' class='' urlparam='']
{
"required":1,
"validate_format":0,
"persist":1,
"default":[],
"options":[[wpv-view name="select-user-exhibitor-raw"]]
}
[/cred_generic_field]

Generated html:
Not saved:

<div class="js-wpt-field-items form-group js-wpt-repetitive wpt-repetitive" data-initial-conditional="" data-item_name="select-_wpcf_belongs_date_id">
<select id="cred_form_3886_1-select-1-1487261282" cred_generic="1" data-wpt-validate="{"required":{"args":{"1":true},"message":"This field is required"}}" data-wpt-field-title="_wpcf_belongs_date_id" class="wpt-form-select form-select form-control js-wpt-validate" data-wpt-type="select" name="_wpcf_belongs_date_id">
<option value="" class="wpt-form-option form-option" data-wpt-type="option" data-wpt-id="cred_form_3886_1_cred_form_3886_1-select-1-1487261282" data-wpt-name="_wpcf_belongs_date_id" selected="selected">--- inte inställd ---</option>
<option value="630" class="wpt-form-option form-option" data-wpt-type="option" data-wpt-id="cred_form_3886_1_cred_form_3886_1-select-1-1487261282" data-wpt-name="_wpcf_belongs_date_id">25 Maj – 28 Maj 2017</option>
</select>
</div>

Saves:

<div class="js-wpt-field-items form-group js-wpt-repetitive wpt-repetitive" data-initial-conditional="" data-item_name="select-_wpcf_belongs_exhibitor_id">
<select id="cred_form_3886_1-select-2-1487261282" cred_generic="1" data-wpt-validate="{"required":{"args":{"1":true},"message":"This field is required"}}" data-wpt-field-title="_wpcf_belongs_exhibitor_id" class="wpt-form-select form-select form-control js-wpt-validate" data-wpt-type="select" name="_wpcf_belongs_exhibitor_id">
<option value="" class="wpt-form-option form-option" data-wpt-type="option" data-wpt-id="cred_form_3886_1_cred_form_3886_1-select-2-1487261282" data-wpt-name="_wpcf_belongs_exhibitor_id" selected="selected">--- inte inställd ---</option>
<option value="369" class="wpt-form-option form-option" data-wpt-type="option" data-wpt-id="cred_form_3886_1_cred_form_3886_1-select-2-1487261282" data-wpt-name="_wpcf_belongs_exhibitor_id">Exempel Knalle: Lakritsfabriken i Ramlösa</option>
</select>
</div>
#490176
Screen Shot 2017-02-16 at 1.26.07 PM.png

Hi Tina, I don't see anything obviously wrong with the markup you have shown here. Could you copy and paste the Request Payload of your form's submission POST request? You can find that in Chrome:

1. Load the page of your site where your CRED form is visible, and open the Web Inspector
2. Go to the Network tab
3. Check the box "Preserve log"
4. Fill out your CRED form and submit
5. A POST request will appear to a URL like ?tt=1234576890 (your form is being submitted)
6. Depending on how you set up your CRED form you may be redirected or the page may refresh.
7. Click the POST request to load details about it (see screenshot)
8. Scroll down to Request Payload
9. Copy everything you see there and paste it into your reply
10. Uncheck "Preserve log" and close the inspector if you like

The topic ‘[Closed] Why generic field select isn't saved to DB’ is closed to new replies.