Skip Navigation

[Resolved] Replace calendar date picker filed with just a text field

This support ticket is created 4 years, 7 months 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 35 replies, has 2 voices.

Last updated by Christian Cox 4 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1577171
calendarfield.jpg

I am having issues with the calendar date option which is one of the fields. It doesn't always work, so I'd like to replace that calendar option with just a text field. What are the steps I need to do to replace that? I didn't build this, so not quite sure how to do that without disrupting anything. Can anyone provide the steps to replace this option with a text field. We have front end forms that the client picks the date and it also shows up on the view pages too both single and archive pages as date of birth. We just want to type in the info vs using the calendar date picker. The person that helped me is no longer available.
thank you.

#1577699

It doesn't always work, so I'd like to replace that calendar option with just a text field. What are the steps I need to do to replace that?
It's not quite as simple as just using a text field, unfortunately, because custom field dates are stored in a specific format that you would have to translate to/from for all date inputs. You would have to add a considerable amount of custom code to use just a text input, because dates can be written in so many different formats and must be validated. The best option here, in my opinion, is to fix whatever is wrong with the existing field. Can you show me an example where the field doesn't work correctly? I might be able to determine the problem and implement a fix using the existing datepicker rather than requiring you to write a ton of extra custom code for this.

#1577995

What if we just delete the date field altogether, then just add a plain text field with the word "date" next to it? Then my client can type in text any way they want for the date. If we delete the field, then the date wouldn't show for any existing dogs there now correct? I don't care to replace what is there, but that way if we add another text field, she can enter whatever text she wants to put. We've had so many issues with it not working properly and she does most of her work from her mobile phone too.

#1578613

Sure you can do that, but you'll lose all ability to sort and filter by this date field, as well as any chance for consistency among dates. You'll probably have to update the templates anywhere this date is shown to use the new field slug.

#1578929

We don't mind losing all that with the dates, but what I need help with is how to delete that calendar field and add a new field in its place. I don't know what the steps would be.
thanks!

#1578937

First you will create a new single line custom field in the same field group as the existing birthdate field. Then in the Form builder, you will replace the existing birthday field with the new field. The specific steps depend on the type of Form Builder you're using, whether it's the drag and drop Form Builder or the expert mode builder. In the drag and drop builder, you'll delete the existing field using the trash icon next to the field, then drag the new field into its place from the list of fields on the right side. In the expert mode builder, you can probably just replace the old birthday field slug with the new field slug. I would need to see the code from the Form to be sure. If there is an Edit Post Form for this post type, you'll need to make similar changes in that Form as well as the create post form.

Then anywhere else you have the birthday field displayed on the site, you'll use the Fields and Views button to add the new birthday field and replace the old field. That could be in a Content Template, or a View of posts, or in a WordPress Archive. You'll have to show me on the site where the field is displayed if you need a recommendation for where to replace the field in wp-admin.

#1579211

OK all I could do without stressing out was to add the new field called "Age". I can see it there on the backend, and also it looks like it is int the content template, but I was too nervous to add it as code in the backend.
Can I send you my details to see my site? I haven't deleted the calendar yet, because I didn't know where else I needed to remove it.
I need to send you my login credentials privately. thank you.

#1583045

Private reply fields are enabled here.

#1587307

Did you get all of my credentials I sent? Still waiting on how to finish this. Thanks.

#1587383

Yes thanks, I'm working on this now.

#1587389

I updated the Add Dog For Sale Form and commented out the original birthday field and added the new age field:

<!--<div class="form-group">
		<label>Date of Birth</label>
		[cred_field field='date-of-birth2' post='dog-for-sale' value='' urlparam='' class='form-control' output='bootstrap']
	</div> -->

    <div class="form-group">
		<label>Age</label>
		[cred_field field='age' post='dog-for-sale' value='' urlparam='' class='form-control' output='bootstrap']
	</div>

I did the same thing in the Dog For Sale Temp template:

<!-- <div class="row">
				<div class="col-sm-4 first-col">Date of Birth</div>
				<div class="col-sm-8 second-col">[types field='date-of-birth2'][/types]</div>
			</div> -->
<div class="row">
				<div class="col-sm-4 first-col">Age</div>
				<div class="col-sm-8 second-col">[types field='age'][/types]</div>
			</div>

Where else should it be added?

#1587455

I think it just shows on the form they enter the information and also on the Puppies For Sale page as well as the single page too.
So 3 places. Archive page and single page and Form.
I tried to test it out just now, but something is not working. The form will not let me submit anything. Can you see why?

#1587457

I'm seeing you have the Date of Birth and the Age.
I just need one line where they actually can enter their date of birth. Say. Feb 1, 2020
So should both be there?

#1587467

The original date of birth field is commented out in the code. I just changed from the original form to the copy form, and I was able to submit correctly. Let me find out why the copy form works but the original does not, just a moment.

#1587525

If either the Available or Sold taxonomy fields are added to the Form, it breaks. I removed both of those taxonomy fields for now, and the Form is submitting as expected. Do you know anything about these two custom taxonomies? What are they for? I don't see any terms in either taxonomy.