I'm working on an Obituary page. One of the facilities I work with is a "Light a candle" function. You can see an example here: hidden link
Click on the "Light a candle link" (See screenshot)
I wonder if it is possible to let the user choose from some predefined images like in this demo. I need some advice on what will be the best approach to get this done.
How can I give the user a set of predefined images to choose from in a Toolset form?
How can the user select an image and use it in their post?
I checked the demo URL you shared and there is no such feature available to implement such functionality where you can select the image.
However - you can always implement it if you have command over custom JS/jQuery. This may require custom and which is beyond the scope of our support policy.
I've been through the examples given on how to display radio button as image. As far as I can see, there are two approaches. Images can be placed in place of radio buttons by using label and span elements, or images could be attached to css classes as background images.
I've created a custom field as a radio group with some dummy labels and values. The radio gruup creates html output as shown below. Based on the output, how can I attach the images using labels or css classes?
Sorry but that will require a lot of custom javascript/jQuery code to add the image to each radio button option and again it will be static. I do not have any workaround to share and to support such custom requirement is beyond the scope of our support policy.
I already shared a few links that may help you and if you do not know how to do it, you may consider hiring a pro javascript developer or you can even choose from our certified partners:
=> https://toolset.com/contractors/
Finally, use the cred_save_data hook to update the custom field
add_action('cred_save_data', 'update_symbol',10,2);
function update_symbol($post_id, $form_data)
{
// This is the CRED form ID
if ($form_data['id']==3805)
{
// 'symbol' is the field name in the CRED generic field setup
if (isset($_POST['symbol']))
{
// 'wpcf-symbol' is the meta key that the value of 'symbol' will be added to
add_post_meta($post_id, 'wpcf-symbol', $_POST['symbol'], true); // Update custom field
}
}
}