Assistance Needed with Employee Assignment Constraints in Form Repeater

By: asghar shaikh | Asked: 10/17/2024
ForumsCategory: General questionsAssistance Needed with Employee Assignment Constraints in Form Repeater
asghar shaikh asked 2 months ago

Hello, I’m new here and need some assistance. We have multiple employees and projects. An employee can only be assigned to one project at a time. Once assigned to a project, such as "Project1," they cannot be assigned to another project like "Project2" until they are free from the first project. However, multiple employees can be assigned to a single project. For example, both "John" and "Mike" are assigned to "Project1." When they complete their tasks and are free, they can then be assigned to other projects. I’m working on a form with a repeater that includes an "Employee" field (a lookup field) and a "Project Assigned" field (a text field). When assigning employees to a new project, I want to display the name of the current project they're assigned to in the "Assigned to" field. For instance, if I try to assign John or Mike to "Project2" while they are still assigned to "Project1," the "Assigned to" field should indicate "Project1." I tried using the shortcode "frm-field-value," but it only returns the last entry in the form rather than a specific entry. Could you suggest a way to achieve this or provide a better approach for handling this scenario? Thank you for giving your precise time.

2 Answers
Rob LeVineRob LeVine answered 2 months ago
When faced with similar issues, I've used jQuery to make an AJAX call, passing the employee ID, and returning the project name/id.
asghar shaikh replied 2 months ago

Thank you Rob for your reply
can you please provide me the code. I am not very techy with ajax and jQuery

Rob LeVineRob LeVine replied 2 months ago

Not really, you can hire me to write custom code for you, but it's not just generic code you can drop in.

Victor Font answered 2 months ago
I might keep projects in a separate lookup table, then you can use dynamic fields for the project assignment. You won't need to use Ajax or frm-field-value extra with dynamic fields.
asghar shaikh replied 2 months ago

Sorry I can't understand
can you please explain in details?
projects are coming from another form called "project assigned" using lookup field.
in repeater assigning employee is lookup field and assigned to is a text field.

I selected the project "project1" from project assigned field and in repeater from "assigning employee field" selected john and submit. Now an entry with employee" john" and project "project1" is exist.
now I want to assign employee to "project2" and if select john so now "project1" should be displayed in "assigned to field".

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right