Sauter la navigation

[Résolu] Default values in forms do not create entry in the data base

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

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

Supporter timezone: Asia/Karachi (GMT+05:00)

Auteur
Publications
#2221629
image 1.png
image 3.png
image 4.png

We have a membership setup.
a WordPress user is created and the CTP profile is added.

In the Cpt Profile is a field radio button profile status 4 options. This field is set that a default value must be "pending-approval" "image one"
If you check the profile details of the specific editor it shows "pending approval".
"image 2"
this is where it goes wrong.
We have report approvals that filter out just pending-approval filters.
image 3 the filter
I am using the following profile to show the issue: Lucia Poorter
Image 4
However, it does not show when the Approvals list are set to Pending approvals.
What we have subsequently figured out is if they update the form s image 4 then suddenly it does show.

So the conclusion is if the field value in a custom field is set to default and the user does not specifically click in the field it shows in the profile but not in the database, No idea how that happens

.

#2221997

Hi,

Thank you for contacting us and I'd be happy to assist.

The settings of your custom field "Profile Status" field are correct and now, whenever you'll create a new post, either using the Toolset Form or the admin area post edit screen, it will automatically set the "Pending-Approval" as the default option.

The admin access details for your website didn't work, but, I've performed some tests on my website with the similar field settings and the default option was correctly applied through the form, even if I didn't select an option, specifically.

It is important to note that if you have some posts which were created before this field's current settings, then it is possible that they don't have any default value set for the field and as a result, they'll not be shown in the view's results.

For such posts, if you'll update them using the Toolset Form or the admin area post edit screen once, the default value will be added, based on the current field settings and they'll start showing in the view's results.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2222065
#2222173

HI Waqar,

I have been able to find a solution for the issue, but i still feel it is some glitch in the system.

My solution was to add the profile status to the Profile form that the user complete. However, the user does not know about this as it is purely an internal issue. So to prevent the user from editing the status we used the "visibility: hidden;" in the CSS. This did cause the field to update and be available for filters. and reflect the user on the approvals system.

Thank you for you assistance

#2223015

Thank you for sharing these details and it all makes sense.

> However, my reasoning was that if an entry is generated it should enter the value in the database.
- The logic of the custom fields is applied at the time of the form submission, based on the available form data, whether you're adding a post using the admin area edit screen or the front-end form.

If your front-end form doesn't include a field for a custom field, its value won't be available in the form's submission and so in the generated post, no default value for that field will be added either.

The workaround that you adopted of including the field in the form and then hiding it using some CSS code is the right thing to do in this case.