I have a form set up to add new members to a Post type, within the post type I have set categories with the year of the membership eg 2020. When a user fills out the form I want them to automatically get added to this category. This element can be hidden on the form.
The form id is 861, the first element on the form is Membership Years, I would like the box named 2021-2022 to be automatically checked so when someone submits the form their membership is allocated to the correct year.
Membership Years is a taxonomy and the slug is membership-year
2021-2022 and 2021-2022 are categories, 2021-2022 has ID=52
Can I do this with js code, not sure the below code is correct but hope you could help or advise or how do I adapt your code and where do I need to put this.
If you are going to preselect the taxonomy then the code I shared is not required.
If you want to use JS to select the taxonomy term checkbox by default, could you please try to use the following JS code and add it to your form's JS box:
I also want to filter the following page. hidden link
In the blue box I have a view which contains the membership years. I have put the same code in the js but can't get the default date to be checked. Do I need the code somewhere else.
Glad to know that solution I shared help you to resolve your issue.
That is totally new issue. As per our support policy, we entertain only one question per ticket. This helps other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported and fixed with this ticket.
May I kindly ask you to open a new ticket with every new question you may have. You are welcome to mark resolve this ticket.