Skip Navigation

[Résolu] Possible wrong class on ellipsis link in archive pagination?

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
How can I populate a Field with options in CRED with some values that I set in a View (so they are dynamic and not hardcoded)?

Solution:
Creating this with Views will not work, Views is not inteded to be used to populate CRED Fields.

What you can do:

1. Create a Types Checkboxes fields and manullay populate that with your options

2. Use a not-supported (with this I mean it's not suggested) way of populating a Generic CRED Checkboxes Field with a valid JSON output

The second is a relatively complex Custom Code approcah that uses several not suggested approaches, while the first is the correct way to go.

If you are interested in the second approach, I suggest you read this Threads:
https://toolset.com/forums/topic/views-not-working-after-installing-v1-11/#post-345278
https://toolset.com/forums/topic/error-using-cred_generic_field-to-let-user-select-the-post-author/
https://toolset.com/forums/topic/add-author-to-post-with-cred/

This support ticket is created Il y a 7 années et 7 mois. 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
- - 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 2 réponses, has 2 voix.

Last updated by dianaM-4 Il y a 7 années et 7 mois.

Assisted by: Beda.

Auteur
Publications
#434673
01_FrontPage.JPG

I am trying to populate and save a CREDS-custom-post-type-field with options from posts of another custom-post-type. But these cpt are not related to each other - there is no parent-child-relationship. Is that possible?

Lets say, that we have a cpt "inquiries" and a CRED-form for creating new posts of type "inquiries", with whom customers can get in touch with me with their inquiries. I have another custom post type "packages", where all of my discount-packages are stored. In the CRED-form "inquiries" I wanna show all of my current packages as checkbox-fields. When the customer is sending his inquiry, I wanna see the selected options in the related post.

It's not difficult to display the options in my CRED-form. I created a new view with all of my current packages as checkbox-fields:

[wpv-layout-start]
	[wpv-items-found]
	<ul class="wpt-form-set wpt-form-set-checkboxes wpt-form-set-checkboxes-wpcf-anfr-aktionen">
	<!-- wpv-loop-start -->
		<wpv-loop>
          <li class="wpt-form-item wpt-form-item-checkbox">
            <input type="checkbox" id="form-[wpv-post-slug]" name="wpcf-anfr-aktionen[]" data-wpt-type="checkbox" data-wpt-id="cred_form_793_1_form-[wpv-post-slug]" data-wpt-name="wpcf-anfr-aktionen[]" value="[wpv-post-title]" data-value="[wpv-post-title]" class="wpt-form-checkbox form-checkbox">
            <label class="wpt-form-label wpt-form-checkbox-label control-label" for="form-[wpv-post-slug]">[wpv-post-title]</label>
          </li>
		</wpv-loop>
	<!-- wpv-loop-end -->
    </ul>
	[/wpv-items-found]
[wpv-layout-end]

And filled in this view in my cred-form:

<div class="cred-field cred-field-anfr-aktionen">
			<label class="cred-label">
[wpml-string context='cred-form-Anfragen-793' name='Sind Sie interessiert an unseren aktuellen Aktionen?']Sind Sie interessiert an unseren aktuellen Aktionen?[/wpml-string]
</label>
			<div class="js-wpt-field-items form-group js-wpt-repetitive wpt-repetitive" data-initial-conditional="" data-item_name="checkoxes-wpcf-anfr-aktionen">
              [wpv-view name="aktionen-liste-fuer-cred-anfrage"]
          	</div>
		</div>

That works in the form, the checkbox-options are showing up (as you can see in the screenshot). But when saving the form, none of the checked values are stored to the database.

I tried to set up a field "wpcf-anfr-aktionen" in my ctp "inquiries" and assigned a singe-text-line to it. I was hoping, that the values of "packages" would then be stored in the database. But with no success.

Can you please help me, to get this up and running?
Thanks in advance!

#434935

It is natively in WordPress required that you edit a Custom Field that exists, with values that match the format of the Database.

in the case of Checkboxes created with Types this is a serialized array, not a simple line.

Creating this with Views will not work, Views is not inteded to be used to populate CRED Fields.

What you can do:

1. Create a Types Checkboxes fields and manullay populate that with your options

2. Use a not-supported (with this I mean it's not suggested) way of populating a Generic CRED Checkboxes Field with a valid JSON output

The second is a relatively complex Custom Code approcah that uses several not suggested approaches, while the first is the correct way to go.

If you need assistance with Custom Code to create your JSON output and store the generic Field in the Database, I suggest you would contact one of our Certified partners:
https://toolset.com/consultant/

You will get the custom assistance you need to get on with your project.

If you are interested in the second approach, I suggest you read this Threads:
https://toolset.com/forums/topic/views-not-working-after-installing-v1-11/#post-345278
https://toolset.com/forums/topic/error-using-cred_generic_field-to-let-user-select-the-post-author/
https://toolset.com/forums/topic/add-author-to-post-with-cred/

#435288

Thanks, Beda,

your links helped me a lot. Unfortunately your first advice isn't working for me, because the options-list will change a lot in the future. And I don't want to give my client access to the custom-post-type-field-settings. So I'm going with the second approach. Everything is working fine know ...

Thanks again!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.