Skip Navigation

[Resolved] required taxonomy, filters, pagination

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 1 year, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2700747
Screen Shot 2024-06-03 at 3.05.53 PM.png

Hi. I have a few issues on this site I'm trying to work out.

1. The first is that I'm trying to make taxonomy field required in a add and edit form. I've tried two different versions of code found in support (linked below) with neither working.

https://toolset.com/forums/topic/how-to-make-a-taxonomy-and-image-upload-field-required/

https://toolset.com/forums/topic/make-a-taxonomy-required-in-a-post-form/

2. The second issue is with pagination. This is an elementor site, for reference, and when we click next page button for a "view", I want for it to go to the top of the view on the next page, but instead it goes to random places, sometimes to the bottom of the page.

3. Similarly, for the view, for filters. At times it breaks into two lines. There doesn't seem to be a rhyme or reason. I want it all to stay on the same line. Sometimes it's fine. Other times it loads fine at first and then after a few minutes, it breaks. Other times, it breaks after clicking "next page"

#2700942

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As per our support policy we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported.

I will take care of the first question and later on will split the ticket with your additional question.

Regarding taxonomy validation not working to make taxonomy required, that is really strange.

Can you please share problem URL where you added the form and tell me what taxonomy you want to validate as required taxonomy and also tell me where exactly you added the code.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2701813

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Before we go further -

I see the "Primary Specialties" taxonomy is set as flat taxonomy. Do you want to set it as flat taxonomy or "Hierarchical" taxonomy?

Can you please confirm?

#2702773

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now:
- hidden link

I've adjusted the code added to "Custom Code" section as given under:

add_filter('cred_form_validate','term_checkboxes_form_validation', 10, 2);
function term_checkboxes_form_validation( $field_data, $form_data ) {
    $tax = 'primary-specialty';
    $forms = array( 7424,7423 );
    $msg = 'At least one Primary Specialty is required.';
 
    // you should not edit below this line
    
    // field data are field values and errors
    list($fields,$errors)=$field_data;
    // validate if correct CRED form ID
    if ( in_array( $form_data['id'], $forms ) ) {

      if ( empty($fields[$tax]['value']) ) {
              $errors[$tax] = $msg;
      }
    }
 
    return array( $fields, $errors );
}

Can you please confirm it works as expected now.

#2704075

This is working now. Thank you. Please open a ticket for the remaining two issues:

2. The second issue is with pagination. This is an elementor site, for reference, and when we click next page button for a "view", I want for it to go to the top of the view on the next page, but instead it goes to random places, sometimes to the bottom of the page.

3. Similarly, for the view, for filters. At times it breaks into two lines. There doesn't seem to be a rhyme or reason. I want it all to stay on the same line. Sometimes it's fine. Other times it loads fine at first and then after a few minutes, it breaks. Other times, it breaks after clicking "next page"

#2704081

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know that solution I shared help you to resolve your issue.

You can mark resolve this ticket and we will continue with the following split ticket:
- https://toolset.com/forums/topic/split-required-taxonomy-filters-pagination-move-page-to-specific-location-after-pagination/