Skip Navigation

[Resolved] Edit post form don't remember category

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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 11 replies, has 2 voices.

Last updated by Marco 1 year, 4 months ago.

Assisted by: Nigel.

Author
Posts
#2626055

Tell us what you are trying to do?
Post is posted via a Post form. A category is chosen via a drop-down menu.
That works well.
Then the post is edited via the post edit form.
All fields are filled with the values entered earlier.
Except the Category.
This dropdown remains empty and must be filled in again.

What is the link to your site?
hidden link

#2626149

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

That doesn't sound right. I just double-checked it on my own test site, where it works as expected: if a post has an existing category assigned, then when editing that post with a Toolset Form the existing category will be pre-selected.

Perhaps something went wrong with your form set up.

Are you using the visual form editor or did you switch to the expert mode?

Can you share details of your form set up, in particular for the category input?

#2626151

Thanks!

I work in Expert Mode:

<div class="row">
<div class="form-group col-md-12">
<label for="%%FORM_ID%%_category">[cred_i18n name='category-label']<h5>Categorie</h5>[/cred_i18n]</label>
[cred_field field='category' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
</div>
</div>

#2626545

Can you help me with this?

#2626637

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

That looks just like the default shortcode, and so I would expect it to work.

Would it be possible to get access to your site to check what is happening? (A staging site would be preferal so that I can actually test submitting the forms and if needed add some utility plugins to help with debugging.)

Let me set a private reply to get credentials from you. You may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

Can you suggest a post to use to test the form with?

#2626657

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Thanks for that.

Everything looks to be set up correctly, but I see that it is not working.

The first thing to check would be to start deactivating other plugins and switching theme, but you have the front page live.

Am I able to do that? Perhaps we could temporarily add a site maintenance plugin?

#2626659

Yes you can, the site is temp under construction.

#2626665

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

OK, that didn't help.

Is it okay if I take a copy of the site to do some more detailed testing locally?

#2626667

Yes you can
Thanks

#2626701

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I can't account for why, but the problem appears to be specific to that particular form.

If I create a new edit form for Bonusproject posts it works as expected, and the category is pre-selected.

Because you have particular markup in your existing form that you would want to preserve, I checked whether I could copy the markup from your form and paste it in to my form to see if the form would still work correctly, and it did, so the problem seems to be buried somewhere in the hidden form settings rather than in the particular markup you are using in the form editor.

So, might I suggest you create a new form, paste in the markup from your existing form, and use the new form instead?

#2626723

Thanks, I'll create a new form.
I'll let you know if it worked.

#2626909

The reason it didn't work was the following script ( JS editor tab):

jQuery(document).ready(function($) {
jQuery("select[name='category[]']").prepend('<option value="">Selecteer een categorie</option>');
jQuery("select[name='category[]']")[0].selectedIndex = 0;
jQuery("select[name='category[]']").attr("required","");
});

This script is of course only for the POST form.
It is now removed and it works.

Thanks for your help