Comparing fields in 2 forms to validate entry in one of the forms

By: Jennifer Mindles | Asked: 08/25/2022
ForumsCategory: How-toComparing fields in 2 forms to validate entry in one of the forms
Jennifer Mindles asked 2 years ago
I have 2 forms, both with a Federal ID field.  If the Federal ID is in one form, I don't want the person to be allowed to submit an entry in the other form.  I'm not finding any code samples to use.  Can anyone help?  Thanks
2 Answers
Rob LeVineRob LeVine answered 2 years ago
Without knowing more about how the forms are used in the UI, I can only give you the general solution that you'd have a PHP program (code snippet) that, using the current user, returns true or false depending on whether the user has filled out either form already (the logic assumes that each unique user has a unique federal id). Then you use the true or false to enable/disable links to the page, hide/show the form, etc.
Jennifer Mindles replied 2 years ago

Hi, so the user IDs are not unique. Citizens are filling out an application form to request assistance and there is a Federal ID field. We want to make sure that people who have submitted and been approved from the first round will not be allowed to submit a second time. The list of previous, approved Federal IDs is in a 2nd form. So when they try to submit an application form, we want it to check the 2nd form to see if the Federal ID exists in that form and if so, display an error message along the lines of You have already received funding assistance. Thanks!

Walter JonesWalter Jones answered 2 years ago

Use a look up field on the application form.  Make it single text field so they can’t see other federal ids inputted.  Set the lookup field to get the data from the federal ID field on the second form.  Mark the lookup field as unique so it can’t be used again.  

That should solve your problem.  

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