Compulsory | WordPress.org

[ad_1]

Hello @stephenboluwatife1

If only one of the fields is required, you can make them required or not by coding.

I’ll try to describe the process with an example.

Assuming the fields’ names are fieldname1 and fieldname2:
Insert a calculated field in the form to be used as an auxiliary. You can hide it by ticking a checkbox in its settings. And enter the following equation through its settings:

(function () {
    var f1 = getField(fieldname1|n).jQueryRef().find(':input'),
	f2 = getField(fieldname2|n).jQueryRef().find(':input');

    if (CONCATENATE(fieldname1|r, fieldname2|r) == '') {
        f1.addClass('required');
        f2.addClass('required');
    } else {
        f1.removeClass('required');
        f2.removeClass('required');
    }
})()

Note I used the fields’ names with modifiers |n and |r. The plugin replaces the fields’ names with their values in the equations before evaluating them. Also, the plugin tries to extract the numbers from the fields’ values to use them in mathematical operations. The |n modifier (Like fieldname1|n) tells the plugin you want to use the field’s name instead of its value. And the |r modifier (fieldname1|r) allows you to use the field’s raw value instead of the preprocessed one.

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer