Skip Navigation

[Resolved] Date field content disappears when editing form

This support ticket is created 7 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 6 replies, has 2 voices.

Last updated by Beda 7 years ago.

Assisted by: Beda.

Author
Posts
#580791

y.S
date-field-1.jpg
date-field-2.JPG

I have a date field set up the way mentioned in this ticket https://toolset.com/forums/topic/limit-date-range-for-cred-form-date-field/

It works fine when creating new content.
I have created a view to limit the list of content to only show the entries of the current user.
Every entry has an edit-button

When I click the edit-button, the correct entry shows, for a few seconds the date field shows the set date in the date field and then it disappears. See attached images.

The value is still there. If I change another field and save the entry, there is no errormessage on the datefield being empty.
It is a little confusing the date value is not visible.

#580796

This seems due to the URL parameter "?content-template-id=" that is create when you link to a CRED form with the CRED Edit Links.

If you insert the Form directly to the View, then it is not happening.

I will escalate this for a review, but please acknowledge that this is partially custom code that we cannot assist 100%.

Nonetheless we need to know why this happens.

I will update you here in regard.

#580809

y.S

Hi,
thanks for your reply.

I have investigated a little more, it seems browser related.
It works fine in Edge (40.15063.674.0), but not in FF (56.0.1)

#581000

y.S

Hi,

I have decided to not make this date field editable when editing the form from frontend, but would still like to know how to solve it.
When I said the field is empty, I meant it is treated like being empty, the placeholder shows up.

I am not quite sure what you mean by 'put the form directly in the View'.

What I am aiming for is a list of entries of the custom posttype, created by the current user.
The entries in that list should have some kind of link so the user can display the details of an individual entry and edit the entry if needed.

Not sure how to do this in a way different from what I have done right now.

#585255

You can solve this with a slightly different JS:

jQuery(window).bind("load", function() {
   jQuery( ".js-wpt-date" ).datepicker( "option", "yearRange", "2002:2015" , ).datepicker( "option", "dateFormat", 'yy-M-dd' ).datepicker("setDate", 'November 24, 2017');
   
});

As you might know right now CRED Forms do not save JS.
Hence, this script needs to be added for example to your Theme's Footer until the issue with CRED JS/CSS not saving is solved.

Thank you!

#586031

y.S

It is weird that using the options of the datepicker, is so troublesome.
It would be nice to just add the desired values in an inputfield when creating the date field.
A simple array like "option1:value2,option2:value2", could do the trick.

In that case you would supply the desired values right away and eliminate the timing issue on loading.
This can be marked as a feature request.

I looked at the code and couldn't find a good point to insert anything.
Although in the file: /cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/js/date.js at line 119
there is mentioning of a beforeShow setting that uses a variable named 'input'.

Would your dev be willing to share where this 'input' variable gets populated?

#586195

Well, that ShortCode accepts a value"" attribute, but let me tell you, I tested it and it does not even parse in the HTML.

I reported that as a BUG, and filed a request to customize the values (which are several) of the Date Field in CRED thru ShortCode attributes or an array of values.

I will not escalate this ticket directly as the issue is not directly affecting it but I filed the BUG so to analyze this.