Skip Navigation

[Resolved] Problems with submit and edit

This thread is resolved. Here is a description of the problem and solution.

Problem: When I try to use my Form, one field is missing. Also when I submit the Form, a datepicker field isn't saved correctly. I have set the value of the datepicker field with JavaScript.

Solution: Check for conditional display logic applied to the missing field. Instead of setting the date field with JavaScript, it is recommended to use the "value" attribute of the field to predefine the correct Unix timestamp.

This support ticket is created 6 years 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)

This topic contains 4 replies, has 2 voices.

Last updated by Franck 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1191589

Hello,

I see two problems on my website.

- First is with the front editing post. On this post : hidden link
We can see the field "Loyer TTC" empty however if we go to the admin we can see it is fill. hidden link

- Second, is an error after submitting a post. the field is not recorded.
Example : hidden link
On the form, we can see the field "Date de Livraison" fill, but when we submit it is not recorded.

I hope you can help me.

#1191704
Screen Shot 2019-01-27 at 6.34.21 PM.png
Screen Shot 2019-01-27 at 6.32.47 PM.png

Hi, I'm seeing several errors on your site related to SSL issues and Cloudflare. This looks like something you need to resolve with your hosting company before we can continue to troubleshoot problems with custom fields and Forms. Please let me know if you need additional information from me to facilitate that conversation.

#1192092

I think the problem with my host was just one or two minutes, you can see the website works right now and i have again the problems with CRED.

#1192240
lot.jpg

We can see the field "Loyer TTC" empty however if we go to the admin we can see it is fill.
I can't see the Loyer TTC field anywhere in the post editor because it's hidden. I'm attaching a screenshot of what I see (lot.jpg), and the Loyer TTC field is not visible. In the DOM inspector I can see the field but it has no value. If you edit the Loyer TTC custom field you can see why the field is hidden. There is custom conditional display logic in "data-dependent display filters" based on the $(dispositif) value:

($(dispositif) eq 'Pinel neuf') OR ($(dispositif) eq 'Résidence principale') OR ($(dispositif) eq 'Résidence principale zone ANRU')

However, there is no "dispositif" custom field, so the custom field will not appear in the Lot editor. There is a taxonomy "dispositif", but no custom field. Custom field conditional display in the post editor screen is only configurable based on other custom fields, not taxonomy terms. So $(dispositif) doesn't work in this context, and the field will not appear. Please refer to the documentation about conditional field display:
https://toolset.com/documentation/user-guides/types-custom-fields-conditional-display/

On the form, we can see the field "Date de Livraison" fill, but when we submit it is not recorded.
The problem is how the field value is set, with JavaScript:

var date_de_livraison = $("#ajout_auto_date-de-livraison").text()
$("input[name*='wpcf-date-de-livraison']").val(date_de_livraison);

Setting a complex field like a datepicker with JavaScript isn't recommended. The recommended method to set the value for a date field is a shortcode that returns the correct Unix timestamp, used in the "value" attribute of the field. The Types field shortcode can return a raw Unix timestamp like this:

[types field="date-de-livraison" output="raw"][/types]

You can put that raw timestamp in the "value" attribute of the cred field, like this:

[cred_field field='date-de-livraison' post='lot' value='[types field="date-de-livraison" output="raw"][/types]' class='form-control' output='bootstrap']
#1197786

My issue is resolved now. Thank you!