Skip Navigation

[Résolu] Conditional otuput from CRED post form to Custom Post Type

This support ticket is created Il y a 6 années et 11 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Auteur
Publications
#537777
Slika zaslona 2017-06-16 19-11-43.png
Slika zaslona 2017-06-16 19-05-42.png
Slika zaslona 2017-06-16 18-38-13.png

Hello again,

I am trying to put some conditional output to my custom post ...
I have CRED post form on the frontend where visitors can input some data which will be published on the fronted after admin approval as a custom post...
At the bottom of CRED form on frontend there is an option where user can choose via checkbox will his name and email be published together with other data from CRED form on the fronted post or not...
So I made it by adding new field ( toolset>post fields> edit group) with Checkbox "Javni osobni podaci" (in translate from croatian: Public Personal Data) , also I put conditional output in other related two fields (email, ime i prezime (name and surname)) which is "javni osobni podaci = 1" (marked checkbox is value 1").
I added also that finput field in CRED form as I mentioned...
Everything looks fine but now on the CRED form on the frontend, when that checkbox is not marked up, those two personal data input fields (email,etc) become hidden...
Please try by yourself mark or unmark checkbox "javni osobni podaci" on this link:
lien caché
Hot to leave those fields NOT hidden in theCRED form? I need those data for sending approval notification email...
I only need possibility for user/visitor just to decide will this fields will be published or not on the frontend...

Thank you in advance,
Sinisa

P.S. This conditional hiding looks awesome but not when I need those data... ????

#537836

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Sinisa,

Thank you for contacting our support forum.

From what I gather from this post you want these fields to be hidden by default and only appear when the user checks the box correct?

Please let me know.

Thanks,
Shane

#538278

Hello,

No, You did not understand me...
I want to have a selection option (checkbox) for user who filling data in the CRED form, whether data of these two fields (name and surname, email) are to be published or not, exclusively on the frontend...
In the related CRED form, these fields should remain visible as these data should be mandatory , BUT conditional display option (added in custom field group) hides those fields in the CRED from ALSO (if user unmark checkboox during filling form)...
So I just want this option as output result on the frontend template (personal data visible or not), CRED form needs to stay intact (without hiding fields with these conditionals), all fields should be visible in the form, even if user unmark conditional checkbox ("javni osobni podaci")...
In short, why adding conditional display in Toolest>Post fields>conditional display option also will make changes on related CRED form ( result with hidding related input fields)?
In our case, we need those fields filled as mandatory ( for email notifications etc.)
So these conditional fields (name and surname, email) should be hidden just on frontend as final result (if user decide so), NOT in the CRED form !

Please let me know do you understand me now, It's tricky to explain such problem for me on English...

Sinisa

#538640

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Sinisa,

I'm still not a clear on it. However Ii believe that you are working with 2 forms correct and whenever the user selects that they want their info to display then the field should be mandatory correct?

Also what you can do is to try explaining in your native language and I'll see how best we can assist you in that language.

Thanks,
Shane

#538704

Huh! ????
My language is Croatian, so I think it will be even harder because you do not have support in Croatian...

I will try once more with simple sentences from beginning ...

I'm working on a web site where users will be able to post some issues in their environment.
They can do this through this CRED form on this page:
lien caché
NOTE: There is only ONE form for that, there is no any other form...

This form provides data for custom post which will be published on the frontend after approval of administrator.

After admin's approval, Problem is published on the frontend like this one:
lien caché

Near the end of post of listed problem you can see last two published fields, email and name/surname of observer (Perceiver:Goran Malovic, email perceiver:gogo@yahoo.com). Please use translate to English!

But some users have said they do not want their personal information to be public!

So I have to add an option to users in the CRED form, so they can decide whether their email and their name and surname will be public or not ...

I have tried to solve this by making condition in the "Toolset/ post Field /EditGroup" for those fields (with personal data "email" and "Name and surname"), by adding a new checkbox "Public personal information?" which is related with personal data fields by conditionals option (which can be set for every custom field under option "Conditional display").
NOTE: Personal data fields (email,name and surname) in CRED form are mandatory because we need those data for notification emails (post approvals etc.).

Everything seemed fine, but if a user decides that he does not want his personal information to be public and unmark checkbox, the entry lines for personal data disappears from the form.
Now the big problem is how any notification email will be sent if the user can not enter his personal data because those input fields are now hidden or deleted by set conditions...

How to leave all fields in CRED form visible or not deleted by conditional output? That the user can fill in all the fields, especially mandatory as email and name and surname (needed for email notifications etc.).
Conditional output should work only for publishing after admin approval of listed problem on the frontend.

Just imagine you want to post some problem onto this site, also you want to receive notifications about it, but don't want your personal information to be publicly released.
CRED Form now hides those input fields and also deletes already entered data, if you decide that your personal information will not be published (by unmarking checbox "public personal data"). It seems it's now working like user don't want even admin knows his personal informations, completely anonymous , without notifications messages...

CRED Form should keep those data, Just not published on frontend! That is what we need...

If you don't understand even now, please sorry on my boring...
In that case just please tell me if there is a way to add a condition "will some data from CRED form be published or not", by user choice during filling that form,but retained in the post's database?
Thanks,
Sinisa

#538739

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Sinisa,

I get what you are saying now 🙂

This is actually quite simple to fix. Instead of adding conditions just add the fields without any conditions at all this way the field will always appear.

Now we add a condition in the view or content template that displays this page. The condition will look something like this

[wpv-conditional if="(($wpcf-fieldname) eq '1')" ]

MY CONTACT INFORMATION

[wpv-conditional]

So this section will only show if the user checks the box for there information to be displayed. Now you will need to change the fieldname to the slug of the custom field while keeping the $wpcf- and then change the 1 to the value that you set the field to when it is checked.

Please let me know if this helps.
Thanks,
Shane

#538765

Hello Shane!

It works!
Also I am glad you finally understand my "English"... ????
Please sorry to bother you, also thank for your patience and effort!

It looks now like this

<p>Opažatelj:<br/>
[wpv-conditional if="( $(wpcf-javni-osobni-podaci) eq '1' )"][types field='ime-i-prezime-opazatelja'][/types][/wpv-conditional]</p>
<p>Email opažatelja:<br/>
[wpv-conditional if="( $(wpcf-javni-osobni-podaci) eq '1' )"][types field='email-opazatelja'][/types][/wpv-conditional]</p>
<hr/>

Once thing more, please can You tell me where to put in code such text as "secret data" or "incognito" to have this message instead empty fileld.?

Maybe this is not related with Toolset, but Toolset is a reason why I am doing tihs...My salvation... ????

#538777

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Sinisa,

I'm happy I was able to assist you 🙂

Also you can create another statement to negate the first so if the box is not checked then you can display a message.

[wpv-conditional if="( $(wpcf-javni-osobni-podaci) ne '1' )"]
Hidden
[/wpv-conditional]</p>

Please let me know if this helps.

Thanks,
Shane

Ce ticket est maintenant fermé. Si vous êtes un client de Toolset et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance