Skip Navigation

[Resolved] How to “set” the value of an invisible checkbox field in a form?

This thread is resolved. Here is a description of the problem and solution.

Problem:

Set the default value to "checked" on checkbox field of Toolset post form.

Solution:

You can try the attribute "value" of shortcode [cred_field], for example:

In "Featured Ad" post form, use below shortcode:
[cred_field field='featured_ad' ... value='1']

Relevant Documentation:

https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#cred_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
- 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/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by PaulS4783 4 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1583581

On this page:
hidden link

This is the submission form for creating a STANDARD vehicle listing on a car directory site.
There will be two "tiers" of directory listing.
One is for a Standard Ad and another for a Featured Ad.
I have two different WooCommerce "products" attached to the two different submission forms.

The custom post type "Listings" has a custom checkbox field for "Featured".
Default is unchecked.

How can I set up the form so that :
a) this field input isn't shown to the user.
and
b) set the default value to "unchecked" for the Standard Ad Listing submission form.
and "checked" on the equivalent Featured Ad Listing submission form.

See below:

hidden link
hidden link
hidden link

#1583809

Hello,

You can try the attribute "value" of shortcode [cred_field], for example:
In "Featured Ad" post form, use below shortcode:
[cred_field field='featured_ad' ... value='1']

Above shortcode will preset the "featured_ad" field value to 1, and setup the checkbox as "checked".

Then use CSS codes to hide "featured_ad" field.

See our document:
https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#cred_field
value. Optional. Preset value

#1584537

Awesome. Solved.

Ideally, there would be a better way than using CSS to create a "hidden" field though.
Anybody with better than intermediate CSS skills could potentially over-ride the "display:none" settings in the source code if they knew what to look for.

Gravity forms has a "hidden field" feature but I'm not sure how they implement it.

You can close ticket.